This article describes how to start React on Rails.
In this section, we are using RubyGem react_on_rails.
At first, add the following to your Gemfile and
Commit this to git and please run following commands:
Please see http://localhost:3000/hello_world.
To manually install this, please execute following command like this:
Supporting following flow:
- Return HTML in first request
- In page transition, return JSON
- Do not show JSON when returning with browser back
Usage example is as follows:
- Router selects Component by
- Display progress bar during page transition
- Scroll to a top of a page after page transition
- Adjust browser history using pushState / popState
When a user clicks a link, a client communicates with the server with XHR and post a state to Router.
So I use the original Link tag instead of a tag.
Link example is as follows:
This is a script to use
webpack in deploy process of ElasticBeansTalk.
To use webpack you need to run
npm install before
rake assets: precompile.
10 is depend on each environment, so please fix it.)
This article has created by the following Japanese articles. Thank you very much, @r7kamura!