I have an App main component with react router:
function App() {
return (
<Router>
<NavBar />
<Switch>
<Route path="/screenings" exact component={SPT} />
<Route path="/registerpage" exact component={RegisterPage} />
<Route path="/loginpage" exact component={LoginPage} />
<Route path="/logout" exact component={LoginPage} />
</Switch>
</Router>
);
}
In main index.js I render that component:
ReactDOM.render(<App />, document.getElementById('root'));
Currently when I click on any link in navigation bar/route
component linked in router is rendered right below the navigation bar in root
div element. However I would like to render those components to mainpage
div that is set below root
div so navbar and rest of the page is clearly separated (placed in 2 different divs). Is there any way to do it?