How to remove component in reactJS?

Posted by Jennifer | Updated on

Want to remove component in reactJS? Well, it seems you should rethink how the display control is handled. React is all about isolated components, and so, you shouldn’t be unmounting a component that is mounted by a parent component. Instead, you should use a callback passed down through props to accomplish something like that.

Your actual implementation will depend on your use case, but an updated version of your example is below:

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

Related Questions & Answers