I've two React components, I want a button click in one to replace it entirely with the second.
So my first Component is delivered inside App root,
function App(){
return (
<div>
<Landing />
</div>
)
}
export default App;
Inside landing, I want a button click to replace it in App with a different Component Marketing. This is not a child Component and they're at the same level.
I'm new to React and have no idea how to do this. Any help appreciated.
Appwould maintain some state for toggling between the two components, and pass a function for setting it down to<Landing/>.