Rails 6

The benefit of using Rails 6 is that it comes with Webpacker, a Javascript bundler, right out of the box. This means that any Javascript framework/packages will work with little to no work!

Starting a new project

You can start a new project by telling it to install dependencies specific to React.

rails new [name] --webpack=react

Head over to the Gemfile and add the react-rails gem.

gem 'react-rails'

We can now tell Rails to add additional files to use React.

rails generate react:install

Adding to an existing project

EDIT (by @Micah Yong )

If you don't have web packer installed, run the following

curl <https://raw.githubusercontent.com/rails/webpacker/master/lib/install/config/webpacker.yml> > config/webpacker.yml
bundle exec rake webpacker:install