Skip to content

shakacode/react_on_rails_pro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

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:

spec/dummy

  1. Uses a standard Shakapacker configuration.
  2. Has pages that demonstrate:
    1. caching
    2. loadable-components
  3. Has all the basic react_on_rails specs that run against the Node Renderer
  4. 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_component and react_component_hash, including lazy evaluation of props.
  • Prerender Caching: Server rendering JavaScript evaluation is cached if prerender_caching is 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.

About

Pro features for React on Rails including Node Rendering, Caching, etc.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 17