react-on-rails
Advanced tools
Changelog
[2.1.0] - 2016-01-26
rails_helper.rb
file to check that the latest Webpack bundles have been generated prior to running tests that may depend on your client-side code. See docs for more detailed instructions. #222display:none
style in the generated content tag for a component. Some developers may want to disable inline styles for security reasons. See generated config initializer file for example on setting skip_display_none
. #218docs
directory. #221Changelog
[2.0.0]
import ReactOnRails from 'react-on-rails';
ReactOnRails.register({name: component});
Best done with Object destructing:
import ReactOnRails from 'react-on-rails';
ReactOnRails.register(
{
Component1,
Component2
}
);
Previously, you used
window.Component1 = Component1;
window.Component2 = Component2;
This would pollute the global namespace. See details in the README.md for more information.
ReactOnRails.render(componentName, props, domNodeId);
such as:
ReactOnRails.render("HelloWorldApp", {name: "Stranger"}, 'app');
react_on_rails
gem.//= require react_on_rails
from any files such as app/assets/javascripts/application.js
. This file comes from npm now.clientRegistration.jsx
and serverRegistration.jsx
rather than Globals
.ReactOnRails.render("MyApp", !{props}, 'app');
entry
section. These are automatically included now.cd client && npm i --save react-on-rails
to get react-on-rails into your client/package.json
.