How to unmount a component on route change in ReactJS?

Posted by Ramesh Singh | Updated on

Want to unmount a component on route change in ReactJS? I think the normal way to handle this is just to unregister and reregister your listeners, reset your state, and so on in componentWillReceiveProps. It’s normal to create abstractions around this behavior:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers