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.
### A complete [React.js](http://facebook.github.io/react/)[Opal Ruby](http://opalrb.org) wrapper.
3
+
[](https://gitter.im/reactrb/chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[**Visit reactrb.org For The Full Story**](http://reactrb.org)
6
-
7
-
[](https://gitter.im/zetachang/react.rb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
It lets you write reactive UI components, with Ruby's elegance using the tried
13
12
and true React.js engine. :heart:
14
13
15
-
### Important: current `react.rb` gem users please [read this!](#road-map)
14
+
[**Visit reactrb.org For The Full Story**](http://reactrb.org)
15
+
16
+
### Important: `react.rb` and `reactive-ruby` gems are **deprecated.** Please [read this!](#upgrading-to-reactrb)
16
17
17
18
## Installation
18
19
19
20
Install the gem, or load the js library
20
21
21
-
+ add `gem 'reactive_rails_generator'` to your gem file [(details)](https://github.com/loicboutet/reactive-rails-generator) and use the generator, or
22
-
+ add `gem 'reactive-ruby'` to your gem file or
23
-
+`gem install reactive-ruby` or
24
-
+ install (or load via cdn) [inline-reactive-ruby.js](http://github.com/reactive-ruby/inline-reactive-ruby)
22
+
+ add `gem 'reactrb'` to your gem file or
23
+
+`gem install reactrb` or
24
+
+ install (or load via cdn) [inline-reactrb.js](http://github.com/reactrb/inline-reactrb)
25
25
26
26
For gem installation it is highly recommended to read [the getting started section at reactrb.org](http://reactrb.org/docs/getting-started.html)
27
27
28
28
## Quick Overview
29
29
30
-
React.rb components are ruby classes that inherit from `React::Component::Base` or include `React::Component`.
30
+
Reactrb components are ruby classes that inherit from `React::Component::Base` or include `React::Component`.
31
31
32
32
`React::Component` provides a complete DSL to generate html and event handlers, and has full set of class macros to define states, parameters, and lifecycle callbacks.
33
33
34
34
Each react component class has a render method that generates the markup for that component.
35
35
36
36
Each react component class defines a new tag-method in the DSL that works just like built-in html tags, so react components can render other react components.
37
37
38
-
As events occur, components update their state, which causes them to rerender, and perhaps pass new parameters to lower level components, thus causing them to rerender.
38
+
As events occur, components update their state, which causes them to rerender, and perhaps pass new parameters to lower level components, thus causing them to rerender.
39
39
40
40
Under the hood the actual work is effeciently done by the [React.js](http://facebook.github.io/react/) engine.
41
41
42
-
React.rb components are *isomorphic* meaning they can run on the server as well as the client. This means that the initial expansion of the component tree to markup is done server side, just like ERB, or HAML templates. Then the same code runs on the client and will respond to any events.
43
-
44
-
React.rb integrates well with Rails, Sinatra, and simple static sites, and can be added to existing web pages very easily, or it can be used to deliver complete websites.
Reactrb components are *isomorphic* meaning they can run on the server as well as the client. This means that the initial expansion of the component tree to markup is done server side, just like ERB, or HAML templates. Then the same code runs on the client and will respond to any events.
49
43
50
-
Refer to [reactive-ruby/react.rb-examples](https://github.com/reactive-ruby/react.rb-examples)to see some live examples in action.
44
+
Reactrb integrates well with Rails, Sinatra, and simple static sites, and can be added to existing web pages very easily, or it can be used to deliver complete websites.
51
45
52
46
## Why ?
53
47
@@ -61,36 +55,78 @@ Refer to [reactive-ruby/react.rb-examples](https://github.com/reactive-ruby/reac
61
55
# Problems, Questions, Issues
62
56
63
57
+[Stack Overflow](http://stackoverflow.com/questions/tagged/react.rb) tag `react.rb` for specific problems.
64
-
+[Gitter.im](https://gitter.im/zetachang/react.rb) for general questions, discussion, and interactive help.
65
-
+[Github Issues](https://github.com/zetachang/react.rb/issues) for bugs, feature enhancements, etc.
58
+
+[Gitter.im](https://gitter.im/reactrb/chat) for general questions, discussion, and interactive help.
59
+
+[Github Issues](https://github.com/reactrb/reactrb/issues) for bugs, feature enhancements, etc.
66
60
67
61
68
-
# Road Map
62
+
# Upgrading to Reactrb
69
63
70
-
The original `react.rb`gem is still available as the [0-3-stable branch.](https://github.com/zetachang/react.rb/tree/0-3-stable)**but please read on..**
64
+
The original gem `react.rb`was superceeded by `reactive-ruby`, which has had over 15,000 downloads. This name has now been superceeded by `reactrb` (see #144 for detailed discussion on why.)
71
65
72
-
Many new features, bug fixes, and improvements are incoporated in the `reactive-ruby` gem currently built on the [0-7-stable branch.](https://github.com/zetachang/react.rb/tree/0-7-stable) In addtion more extensive documentation for the current stable branch is available at [reactrb.org](http://reactrb.org), and the [Opal Ruby Playground](http://fkchang.github.io/opal-playground/?code:&html_code=%3Cdiv%20id%3D%22container%22%3E%3C%2Fdiv%3E%0A&css_code=body%20%7B%0A%20%20background%3A%20%23eeeeee%3B%0A%7D%0A) incorporates the current stable branch.
66
+
Going forward the name `reactrb` will be used consistently as the organization name, the gem name, the domain name, the twitter handle, etc.
73
67
74
-
Our plan is to do one more upgrade on the `reactive-ruby` gem which will be designated version 0.8.0. [click for detailed feature list](https://github.com/zetachang/react.rb/milestones/0.8.x)
68
+
The first initial version of `reactrb` is 0.8.x.
75
69
76
-
From 0.9.0 and beyond we will return to using the `react.rb` gem for releases, and `reactive-ruby`will continue as a meta gem that depends only on react.rb >= 0.9.x.
70
+
It is very unlikely that there will be any more releases of the `reactive-ruby` gem, so users should upgrade to `reactrb`.
77
71
78
-
Version 0.9.0 of `react.rb`**will not be** 100% backward compatible with 0.3.0 so its very important to begin your upgrade process now by switching to `reactive-ruby` 0.7.0.
72
+
There are no syntactic or semantic breaking changes between `reactrb` v 0.8.x and
73
+
previous versions, however the `reactrb` does *not* include the react js source as previous versions did. This allows you to pick the react js source compatible with other gems and react js components you may be using.
79
74
80
-
Please let us know either at [Gitter.im](https://gitter.im/zetachang/react.rb) or [via an issue](https://github.com/zetachang/react.rb/issues) if you have specific concerns with the upgrade from 0.3.0 to 0.9.0.
75
+
To upgrade, replace `reactive-ruby` with `reactrb`, both in your Gemfile, and in any `requires` in your code. You will also need to require react-js as this is no longer included in the gem.
81
76
82
-
## Contributing
77
+
If you are using react-rails then simply find anyplace where you `require 'reactrb'` and immediately before this do a `require 'react'` which will load the compatible react js file.
83
78
84
-
This project is still in early stage, so discussion, bug reports and PRs are
85
-
really welcome :wink:.
79
+
If you are using webpack then add `react` to your manifest.
80
+
81
+
If you are not using react-rails then find where you `require 'reactrb'` and immediately before this do a `require 'react-latest'` (or 'react-v13', 'react-v14' or 'react-v15')
82
+
83
+
# Roadmap
84
+
85
+
Upcoming will be an 0.9.x release which will deprecate a number of features and DSL elements. [click for detailed feature list](https://github.com/reactrb/reactrb/milestones/0.9.x)
86
+
87
+
Version 0.10.x **will not be** 100% backward compatible with 0.3.0 (`react.rb`) or 0.7.x (`reactive-ruby`) so its very important to begin your upgrade process now by switching to `reactrb` now.
88
+
89
+
Please let us know either at [Gitter.im](https://gitter.im/react/chat) or [via an issue](https://github.com/react/reactrb/issues) if you have specific concerns with the upgrade from 0.3.0 to 0.10.x.
86
90
87
-
#### Testing react.rb
91
+
## Developing
92
+
93
+
`git clone` the project.
94
+
95
+
To play with some live examples cd to the project directory then
96
+
97
+
2.`cd example/examples`
98
+
2.`bundle install`
99
+
3.`bundle exec rackup`
100
+
4. Open `http://localhost:9292`
101
+
102
+
or
103
+
104
+
1.`cd example/rails-tutorial`
105
+
2.`bundle install`
106
+
3.`bundle exec rails s`
107
+
4. Open `http://localhost:3000`
108
+
109
+
or
110
+
111
+
1.`cd example/sinatra-tutorial`
112
+
2.`bundle install`
113
+
3.`bundle exec rackup`
114
+
4. Open `http://localhost:9292`
115
+
116
+
Note that these are very simple examples, for the purpose of showing how to configure the gem in various server environments. For more examples and information see [reactrb.org.](http://reactrb.org)
117
+
118
+
## Testing
119
+
120
+
1. Run `bundle exec rake test_app` to generate a dummy test app.
121
+
2.`bundle exec rake`
122
+
123
+
## Contributions
124
+
125
+
This project is still in early stage, so discussion, bug reports and PRs are
126
+
really welcome :wink:.
88
127
89
-
1.`bundle install`
90
-
2.`bundle exec rake test_app` to generate a dummy test app.
91
-
3.`bundle exec rake`
92
128
93
129
## License
94
130
95
-
In short, React.rb is available under the MIT license. See the LICENSE file for
131
+
In short, Reactrb is available under the MIT license. See the LICENSE file for
0 commit comments