I am using ReactJS and I have a login screen. Only after you login should the user should be shown the header. Right now, the header is appearing on the login screen, which I don't want. How do I get rid of it?
I've tried wrapping the Login path in its own Router, but that doesn't help. The header still renders. The code below is in index.js. That's where all my routing is done and calling other components.
const routing = (
<div>
<Router>
<Switch>
<Route path="/" exact component={Login} />
</Switch>
</Router>
<Router>
<Header>
<Switch>
<Route path="/landingpage/videos" exact component={Videos} />
</Switch>
<Switch>
<Route path="/landingpage/contact-us" exact component={Contact} />
</Switch>
<Switch>
<Route path="/landingpage/stats/" exact component={Stats} />
</Switch>
</Header>
</Router>
</div>
);
ReactDOM.render(routing, document.getElementById("root"));