File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Expand file tree Collapse file tree 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
129129```
130130
131131On 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 ` .
134133
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 ` .
136135 __ Turbolinks >= 2.4.0__ is recommended because it exposes better events.
137136
138137The view helper's signature is:
Original file line number Diff line number Diff line change 8989 function handleNativeEvents ( ) {
9090 if ( $ ) {
9191 $ ( function ( ) { window . ReactRailsUJS . mountComponents ( ) } ) ;
92- $ ( window ) . unload ( function ( ) { window . ReactRailsUJS . unmountComponents ( ) } ) ;
9392 } else {
9493 document . addEventListener ( 'DOMContentLoaded' , function ( ) { window . ReactRailsUJS . mountComponents ( ) } ) ;
95- window . addEventListener ( 'unload' , function ( ) { window . ReactRailsUJS . unmountComponents ( ) } ) ;
9694 }
9795 }
9896
You can’t perform that action at this time.
0 commit comments