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:
- Toggling the visibility of component
- 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.