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

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, privacy policy and cookie policy

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