I have a requirement in which I have to hide the component from the page and load a new component.

Which one is the preferred approach:

  1. Toggling the visibility of component
  2. Using routes

2 Answers 2


For the same problem I used a different approach. 2 child components had button click event which gave a call back to a common parent component.

In parent component I using switch case to decide which child component to display next.


ReactDom.render() will unload the existing component and load the new one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.