README.md in react-rails-2.0.0 vs README.md in react-rails-2.0.2
- old
+ new
@@ -57,11 +57,11 @@
```
The component name tells `react-rails` where to load the component. For example:
`react_component` call | component `require`
-=======================|======================
+-----|-----
`react_component("Item")` | `require("Item")`
`react_component("items/index")` | `require("items/index")`
`react_component("items.Index")` | `require("items").Index`
`react_component("items.Index.Header")` | `require("items").Index.Header`
@@ -243,10 +243,17 @@
- `jQuery`
- Native DOM events
`ReactRailsUJS` will automatically mount components on `<%= react_component(...) %>` tags and unmount them when appropriate.
-Be sure to load `react_ujs` _after_ these libraries so that it can detect them.
+If you need to re-detect events, you can call `detectEvents`:
+
+```js
+// Remove previous event handlers and add new ones:
+ReactRailsUJS.detectEvents()
+```
+
+For example, if `Turbolinks` is loaded _after_ `ReactRailsUJS`, you'll need to call this again. This function removes previous handlers before adding new ones, so it's safe to call as often as needed.
### `getConstructor`
Components are loaded with `ReactRailsUJS.getConstructor(className)`. This function has two built-in implementations: