See the CHANGELOG for release updates and upgrade details.
React on Rails Pro
Node rendering and caching performance enhancements for React on Rails (Documentation).
Getting Started
The best way to see how React on Rails Pro works is to install this repo locally and take a look at the example application:
- Uses a standard Shakapacker configuration.
- Has pages that demonstrate:
- caching
- loadable-components
- Has all the basic react_on_rails specs that run against the Node Renderer
- Demonstrates using HMR and loadable-components with almost the same example that is present in loadable-components for SSR
See the README.md in those sample apps for more details.
Features
Caching
Caching of SSR is critical for achieving optimum performance.
-
Fragment Caching: for
react_componentandreact_component_hash, including lazy evaluation of props. -
Prerender Caching: Server rendering JavaScript evaluation is cached if
prerender_cachingis turned on in your Rails config. This applies to all JavaScript evaluation methods.
See docs/caching for more details.
Clearing of Global State
If you detect that some library used in server-rendering is leaking state between calls to server render, then you can set the config.ssr_pre_hook_js in your config/initializers/react_on_rails_pro.rb to run some JavaScript to clear the globally leaked state at the beginning of each call to server render.
For more details, see Rails Configuration.
React On Rails Pro Node Renderer
The "React on Rails Pro Node Renderer" provides more efficient server rendering on a standalone Node JS server. See the Node Renderer Docs.
Bundle Caching
Don't wait for the same webpack bundles to built over and over. See the bundle-caching docs.
Other Utility Methods
See the Ruby API.
References
Contributing
Please see CONTRIBUTING for more details.