The Nested Routes example provided by React Router V6 docs does not work. I tried this with "react-router-dom": "^6.2.1" and the children routes doesn't work. It returns the root element when I try to access /parent or /parent/child:
<BrowserRouter>
<Routes>
<Route path="/" element={<div>Root</div>}>
<Route path="parent" element={<div>Parent</div>}>
<Route path="child" element={<div>Child</div>} />
</Route>
</Route>
</Routes>
</BrowserRouter>
The /parent route just works if I remove the element from the root route: <Route path="/" >. But in this case I get the warning below, the page '/' is empty and the '/parent/child' still doesn't work.
Matched leaf route at location "/" does not have an element. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.
I would really appreciate any help to better understand this behavior.