File tree 2 files changed +2
-5
lines changed
2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -129,10 +129,9 @@ The __view helper__ puts a `div` on the page with the requested component class
129
129
```
130
130
131
131
On page load, the __ ` react_ujs ` driver__ will scan the page and mount components using ` data-react-class `
132
- and ` data-react-props ` . Before page unload, it will unmount components (if you want to disable this behavior,
133
- remove ` data-react-class ` attribute in ` componentDidMount ` ).
132
+ and ` data-react-props ` .
134
133
135
- ` react_ujs ` uses Turbolinks events if they're available, otherwise, it uses native events .
134
+ If Turbolinks is present components are mounted on the ` page:change ` event, and unmounted on ` page:before-unload ` .
136
135
__ Turbolinks >= 2.4.0__ is recommended because it exposes better events.
137
136
138
137
The view helper's signature is:
Original file line number Diff line number Diff line change 89
89
function handleNativeEvents ( ) {
90
90
if ( $ ) {
91
91
$ ( function ( ) { window . ReactRailsUJS . mountComponents ( ) } ) ;
92
- $ ( window ) . unload ( function ( ) { window . ReactRailsUJS . unmountComponents ( ) } ) ;
93
92
} else {
94
93
document . addEventListener ( 'DOMContentLoaded' , function ( ) { window . ReactRailsUJS . mountComponents ( ) } ) ;
95
- window . addEventListener ( 'unload' , function ( ) { window . ReactRailsUJS . unmountComponents ( ) } ) ;
96
94
}
97
95
}
98
96
You can’t perform that action at this time.
0 commit comments