I have a backbone application, where i am trying to integrate React ponents.
React ponent is mounted using following code :
ReactDOM.render(
<WrappedComponent />, node
);
where node is the DOM mode. This way React lifecycle events like ponentWillMount and ponentDidMount are getting called fine.
But when routing happen through Backbone routing, and React ponent getting removed from DOM, ponentWillUnmount is not invoked.
Any solutions ?
I have a backbone application, where i am trying to integrate React ponents.
React ponent is mounted using following code :
ReactDOM.render(
<WrappedComponent />, node
);
where node is the DOM mode. This way React lifecycle events like ponentWillMount and ponentDidMount are getting called fine.
But when routing happen through Backbone routing, and React ponent getting removed from DOM, ponentWillUnmount is not invoked.
Any solutions ?
Share Improve this question asked Jan 9, 2016 at 8:23 Abhijeet MishraAbhijeet Mishra 4434 silver badges13 bronze badges1 Answer
Reset to default 15ponentWillUnmount
does not get called automatically when the container node gets removed. It only gets called:
- At the top level, when you call
ReactDOM.unmountComponentAtNode
- As child ponents, when the parent unmounts the ponent