最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - componentWillUnmount is not getting invoked - Stack Overflow

programmeradmin1浏览0评论

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 badges
Add a ment  | 

1 Answer 1

Reset to default 15

ponentWillUnmount does not get called automatically when the container node gets removed. It only gets called:

  1. At the top level, when you call ReactDOM.unmountComponentAtNode
  2. As child ponents, when the parent unmounts the ponent
发布评论

评论列表(0)

  1. 暂无评论