react-on-rails
Advanced tools
Changelog
[12.0.4] - 2020-11-14
Changelog
[12.0.3] - 2020-09-20
Changelog
[12.0.0] - 2020-07-08
For upgrade instructions, see docs/guides/upgrading-react-on-rails.md.
In order to solve the issues regarding React Hooks compatibility, the number of parameters
for functions is used to determine if you have a generator function that will get invoked to
return a React component, or you are registering a functional React component. Alternately, you can
set JavaScript property renderFunction
on the function for which you want to return to be
invoked to return the React component. In that case, you won't need to pass any unused params.
PR 1268 by justin808
See docs/guides/upgrading-react-on-rails for details.
react_on_rails
fully supports rails/webpacker
. The example test app in spec/dummy
was recently converted over to use rails/webpacker v4+. It's a good example of how to leverage rails/webpacker's webpack configuration for server-side rendering.
Changed the precompile task to use the rails/webpacker one by default
Updated generators to use React hooks
Requires the use of rails/webpacker view helpers
If the webpacker webpack config files exist, then React on Rails will not override the default
assets:precompile setup by rails/webpacker. If you are not using the rails/webpacker setup for webpack,
then be sure to remove the JS files inside of config/webpack, like config/webpack/production.js.
Removed env_javascript_include_tag and env_stylesheet_link_tag as these are replaced by view helpers from rails/webpacker
Removal of support for old Rubies and Rails.
Removal of config.symlink_non_digested_assets_regex as it's no longer needed with rails/webpacker. If any business needs this, we can move the code to a separate gem.
Added configuration option same_bundle_for_client_and_server
with default false
because
The previous behavior was to always go to the webpack-dev-server for the server bundle if the
webpack-dev-server was running and the server bundle was found in the manifest.json
.
If you are using the same bundle for client and server rendering, then set this configuration option
to true
. By justin808.
Added support to export locales in JSON format. New option added i18n_output_format
which allows to
specify locales format either JSON
or JS
. JSON
format is now the default.
Use this config setting to get the old behavior: config.i18n_output_format = 'js'
PR 1271 by ashgaliyev.