You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
To hook into native ReactComponent life cycle, the native `this` will be passed to the class's initializer. And all corresponding life cycle methods (`componentDidMount`, etc) will be invoked on the instance with using the corresponding snakecase method name.
42
+
To hook into native ReactComponent life cycle, the native `this` will be passed to the class's initializer. And all corresponding life cycle methods (`componentDidMount`, etc) will be invoked on the instance using the corresponding snake-case method name.
* Callback of life cycle could be created through `before_mount`, `after_mount`, etc
87
-
*`this.props` is provided through method `self.params`
88
-
* Use class method `define_method` to create setter & getter of `this.state` for you
107
+
* Callback of life cycle could be created through helpers `before_mount`, `after_mount`, etc
108
+
*`this.props` is accessed through method `self.params`
109
+
* Use helper method `define_state` to create setter & getter of `this.state` for you
110
+
* For the detailed mapping to the original API, see [this issue](https://github.com/zetachang/react.rb/issues/2) for reference. Complete reference will come soon.
89
111
90
112
### Props validation
91
113
92
-
How about props validation? Inspired from [Grape API](https://github.com/intridea/grape), props validation rule could be create easily through `params` class method as below,
114
+
How about props validation? Inspired from [Grape API](https://github.com/intridea/grape), props validation rule could be created easily through `params` class method as below,
93
115
94
116
```ruby
95
117
classApp
118
+
includeReact::Component
119
+
96
120
params do
97
121
requires :username, type:String
98
122
requires :enum, values: ['foo', 'bar', 'awesome']
@@ -101,7 +125,9 @@ class App
101
125
optional :flash_message, type:String, default:'Welcome!'# no need to feed through `getDefaultProps`
102
126
end
103
127
104
-
defrender; end
128
+
defrender
129
+
div
130
+
end
105
131
end
106
132
```
107
133
@@ -110,6 +136,13 @@ end
110
136
* React Tutorial: see [example/react-tutorial](example/react-tutorial), the original CommentBox example.
111
137
* TodoMVC: see [example/todos](example/todos), your beloved TodoMVC <3.
112
138
139
+
## TODOS
140
+
141
+
* Mixins examples
142
+
* Documentation
143
+
* API wrapping coverage of the original js library (pretty close though)
144
+
* React Native?
145
+
113
146
## Developing
114
147
115
148
To run the test case of the project yourself.
@@ -121,7 +154,7 @@ To run the test case of the project yourself.
121
154
122
155
## Contributions
123
156
124
-
This project is still in early stage, so discussion, bug report and PR are really welcome :wink.
157
+
This project is still in early stage, so discussion, bug report and PR are really welcome :wink:.
125
158
126
159
## Contact
127
160
@@ -130,4 +163,4 @@ This project is still in early stage, so discussion, bug report and PR are reall
130
163
131
164
## License
132
165
133
-
In short, IPSqueezableViewController is available under the MIT license. See the LICENSE file for more info.
166
+
In short, React.rb is available under the MIT license. See the LICENSE file for more info.
0 commit comments