- The index route demonstrates a React component being rendered using data from a rails controller.
- The about route is a normal ERB route.
- The talks route uses standard ERB, and then a React component below it which receives its props from the talks controller.
In this way, you can introduce React only on specific pages.
- Yarn must be installed
- Install bundler dependencies:
bundle
- Install javascript dependencies:
yarn
- Build database:
rails db:migrate
- Load sample data:
rake sample
- Load webpack dev server and rails together
foreman start
- View the webpage at http://localhost:5000
You can see a demo here.