App component contains Navbar. Page component contains main. Idea - to show App component and page components together when the url is 'localhost:3000/authentication' But when I am on this url - it shows navbar only.
ReactDOM.render(
<BrowserRouter>
<Routes>
<Route path="/" element={<App />}>
<Route path="authentication" element={<Authentication />} />
</Route>
</Routes>
</BrowserRouter>,
document.getElementById("root")
);
But when I do it without nesting it shows me App on '/' url and Auth on 'auth' url:
ReactDOM.render(
<BrowserRouter>
<Routes>
<Route path="/" element={<App />}/ >
<Route path="authentication" element={<Authentication />} />
</Routes>
</BrowserRouter>,
document.getElementById("root")
First example should work, but he doesn't. Using useNavigate