React-Rails is a flexible tool to use React with Rails. If you use Jbuilder to pass a JSON string to react_component, make sure your JSON is a stringified hash, not an array. This is not the Rails default, you should add the root node yourself. React-Rails 2.4.x uses React 16+ which no longer has React Addons. Therefore the pre-bundled version of react no longer has an addons version, if you need addons still, there is the 2.3.1+ version of the gem that still has addons. React-Rails supports plenty of file extensions such as: .js, .jsx.js, .js.jsx, .es6.js, .coffee, etcetera! Sometimes this will cause a stumble when searching for filenames. The require.context inserted into packs/application.js is used to load components. The component name tells react-rails where to load the component.
Features
- Automatically renders React server-side and client-side
- Supports Webpacker 4.x, 3.x, 2.x, 1.1+
- Supports Sprockets 4.x, 3.x, 2.x
- Lets you use JSX, ES6, TypeScript, CoffeeScript
- Webpacker provides modern JS tooling for Rails
- Additional information about React-Rails can be found in the Wiki page