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
**This React.rb is a a fork of the original [React.rb](https://github.com/zetachang/react.rb)[Opal Ruby](http://opalrb.org) wrapper of [React.js library](http://facebook.github.io/react/)**.
5
+
**React-opal is a a fork of the original [React.rb](https://github.com/zetachang/react.rb)[Opal Ruby](http://opalrb.org) wrapper of [React.js library](http://facebook.github.io/react/)**.
6
6
7
7
## Why fork?
8
8
* Keep it simple, don't create an entire framework, just focus on React and Opal
Note: This library does not directly include a react source dependency. This allows you to specify on your own (NPM, Bower, GEMs, etc.) how you wish to use React.
31
+
The version number of react-opal simply reflects which version of React that react-opal has been tested with.
31
32
32
33
For integration with server (Sinatra, etc), see setup of [TodoMVC](examples/todos) or the [official docs](http://opalrb.org/docs/) of Opal.
33
34
@@ -145,6 +146,34 @@ def render
145
146
end
146
147
```
147
148
149
+
### Context
150
+
151
+
You can use the React context feature to pass values down a component hierarchy chain.
152
+
153
+
```ruby
154
+
classParentComponent
155
+
includeReact::Component
156
+
157
+
# Simply supply the Ruby/Opal type that :foo will be and react-opal will map that to a React PropType automatically
# will render the :foo_value prop passed into ParentComponent
172
+
div { "foo is #{self.context[:foo]}" }
173
+
end
174
+
end
175
+
```
176
+
148
177
### Props validation
149
178
150
179
How about props validation? Inspired by [Grape API](https://github.com/intridea/grape), props validation rule could be created easily through `params` class method as below,
@@ -256,6 +285,7 @@ TBD
256
285
## License
257
286
258
287
Originally Copyright (c) 2015 Yi-Cheng Chang (http://github.com/zetachang)
0 commit comments