In my React app, I have a navigation bar on top. I call this Navbar component in App.js as shown below.
export default function App() {
return (
<Router>
<Fragment>
<Navbar />
<Route exact path="/" component={Home} />
<section>
<Switch>
<Route exact path="/login" component={Login} />
<PrivateRoute exact path="/dashboard" component={Dashboard} />
</Switch>
</section>
</Fragment>
</Router>
);
}
The problem is that, whenever I hit any of these URLs like '/login', '/dashboard', The component associated with them renders behind the navbar and not below it. While I can add multiple <br/> tags below <Navbar />to shift these components below, but this does not seem like a good solution as some components already have significant whitespace above them and adding <br/> will shift them even further below which I don't want. How to solve this issue? My other components return simple <div>. My Navbar is a <Appbar position='fixed'> from the material-ui/core library.
NavBarcomponent. It needs to bedisplay: "flex"; flex: 1;