CHANGELOG.md in react_on_rails-2.0.1 vs CHANGELOG.md in react_on_rails-2.0.2
- old
+ new
@@ -3,53 +3,54 @@
## v2.0.0
- Move JavaScript part of react_on_rails to npm package 'react-on-rails'.
- Converted JavaScript code to ES6! with tests!
- No global namespace pollution. ReactOnRails is the only global added.
-- New API. Instead of placing React components on the global namespace, you instead call ReactOnRails.register, passing an object where keys are the names of your components.
- ```
+- New API. Instead of placing React components on the global namespace, you instead call ReactOnRails.register, passing an object where keys are the names of your components:
+```
+import ReactOnRails from 'react-on-rails';
+ReactOnRails.register({name: component});
+```
+Best done with Object destructing:
+```
import ReactOnRails from 'react-on-rails';
- ReactOnRails.registerComponent({name: component});
- ```
- Best done with Object destructing
- ```
- import ReactOnRails from 'react-on-rails';
- ReactOnRails.registerComponent(
+ ReactOnRails.register(
{
Component1,
Component2
}
);
+```
+ Previously, you used
```
- Previously, you used
- ```
window.Component1 = Component1;
window.Component2 = Component2;
```
This would pollute the global namespace. See details in the README.md for more information.
- Your jade template for the WebpackDevServer setup should use the new API:
- ```
+```
ReactOnRails.render(componentName, props, domNodeId);
- ```
+```
such as:
- ```
+```
ReactOnRails.render("HelloWorldApp", {name: "Stranger"}, 'app');
- ```
+```
- All npm dependency libraries updated. Most notable is going to Babel 6.
- Dropped support for react 0.13.
-- JS Linter uses ShakaCode JavaScript style: https://github.com/shakacode/style-guide-javascript
+- JS Linter uses ShakaCode JavaScript style: https://github.com/shakacode/style-guide-javascript
- Generators account these differences.
### Migration Steps
[Example of upgrading](https://github.com/shakacode/react-webpack-rails-tutorial/commit/5b1b8698e8daf0f0b94e987740bc85ee237ef608)
-1. Update the `react_on_rails` gem
-2. Search you app for 'generator_function' and remove lines in layouts and rb files that contain it. Determination of a generator function is handled automatically.
-3. Find your files where you registered client and server globals, and use the new ReactOnRails.register syntax. Optionally rename the files `clientRegistration.jsx` and `serverRegistration.jsx` rather than `Globals`.
-4. Update your index.jade to use the new API `ReactOnRails.render("MyApp", !{props}, 'app');`
-5. Update your webpack files per the example commit. Remove globally exposing React and ReactDom, as well as their inclusion in the `entry` section. These are automatically included now.
-
-That's it!
+1. Update the `react_on_rails` gem.
+2. Remove `//= require react_on_rails` from any files such as `app/assets/javascripts/application.js`. This file comes from npm now.
+3. Search you app for 'generator_function' and remove lines in layouts and rb files that contain it. Determination of a generator function is handled automatically.
+4. Find your files where you registered client and server globals, and use the new ReactOnRails.register syntax. Optionally rename the files `clientRegistration.jsx` and `serverRegistration.jsx` rather than `Globals`.
+5. Update your index.jade to use the new API `ReactOnRails.render("MyApp", !{props}, 'app');`
+6. Update your webpack files per the example commit. Remove globally exposing React and ReactDom, as well as their inclusion in the `entry` section. These are automatically included now.
+7. Run `cd client && npm i --save react-on-rails` to get react-on-rails into your `client/package.json`.
+8. You should also update any other dependencies if possible to match up with the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/).
## v1.2.2
### Fixed
- Missing Lodash from generated package.json [#175](https://github.com/shakacode/react_on_rails/pull/175)
- Rails 3.2 could not run generators [#182](https://github.com/shakacode/react_on_rails/pull/182)