This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
# React.rb
2
2
3
- ** React.rb is a [ Opal Ruby] ( http://opalrb.org ) wrapper of [ React.js library] ( http://facebook.github.io/react/ ) ** .
3
+ ** React.rb is an [ Opal Ruby] ( http://opalrb.org ) wrapper of [ React.js library] ( http://facebook.github.io/react/ ) ** .
4
4
5
5
It let you write reactive UI component with Ruby's elegancy and compiled to run in Javascript. :heart :
6
6
@@ -16,6 +16,7 @@ and in your Opal application,
16
16
``` ruby
17
17
require " opal"
18
18
require " react"
19
+
19
20
React .render(React .create_element(' h1' ){ " Hello World!" }, ` document.body` )
20
21
```
21
22
@@ -34,7 +35,9 @@ class HelloMessage
34
35
end
35
36
end
36
37
37
- React .render_static_markup(React .create_element(HelloMessage )) # => '<div>Hello World!</div>'
38
+ puts React .render_to_static_markup(React .create_element(HelloMessage ))
39
+
40
+ # => '<div>Hello World!</div>'
38
41
```
39
42
40
43
### More complicated one
@@ -99,8 +102,11 @@ class App
99
102
end
100
103
101
104
puts React .render_to_static_markup(React .create_element(App ))
105
+
102
106
# => '<div><span>Default greeting: Cool! John!</span></div>'
107
+
103
108
React .render(React .create_element(App ), ` document.body` )
109
+
104
110
# mounted!
105
111
```
106
112
You can’t perform that action at this time.
0 commit comments