README.md in react-rails-1.1.0 vs README.md in react-rails-1.2.0
- old
+ new
@@ -127,14 +127,13 @@
<!-- becomes: -->
<div data-react-class="HelloMessage" data-react-props="{"name":"John"}"></div>
```
On page load, the __`react_ujs` driver__ will scan the page and mount components using `data-react-class`
-and `data-react-props`. Before page unload, it will unmount components (if you want to disable this behavior,
-remove `data-react-class` attribute in `componentDidMount`).
+and `data-react-props`.
-`react_ujs` uses Turbolinks events if they're available, otherwise, it uses native events.
+If Turbolinks is present components are mounted on the `page:change` event, and unmounted on `page:before-unload`.
__Turbolinks >= 2.4.0__ is recommended because it exposes better events.
The view helper's signature is:
```ruby
@@ -149,12 +148,10 @@
- `**other` Any other arguments (eg `class:`, `id:`) are passed through to [`content_tag`](http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).
### Server rendering
-(This documentation is for the __`master` branch__, please check the [__`1.0.0` README__](https://github.com/reactjs/react-rails/tree/v1.0.0#server-rendering) for that API!)
-
To render components on the server, pass `prerender: true` to `react_component`:
```erb
<%= react_component('HelloMessage', {name: 'John'}, {prerender: true}) %>
<!-- becomes: -->
@@ -203,11 +200,11 @@
- If you're using JRuby, you can increase `pool_size` to have real multi-threaded rendering.
### Component generator
`react-rails` ships with a Rails generator to help you get started with a simple component scaffold.
-You can run it using `rails generate react:component ComponentName`.
+You can run it using `rails generate react:component ComponentName (--es6)`.
The generator takes an optional list of arguments for default propTypes,
which follow the conventions set in the [Reusable Components](http://facebook.github.io/react/docs/reusable-components.html)
section of the React documentation.
For example:
@@ -237,9 +234,21 @@
</div>
);
}
});
```
+
+#### Options
+
+**--es6** : Generate the same component but using cutting edge es6 class
+
+For example:
+
+```shell
+rails generate react:component Label label:string --es6
+```
+
+#### Arguments
The generator can use the following arguments to create basic propTypes:
* any
* array