".." links are confusing when using index routes #8998
-
From the
This suggests that, to go from Is this working as intended? Do you agree that the real behavior seems to differ from what you would intuitively expect and what is stated in the documentation? import { BrowserRouter, Routes, Route, Link } from "react-router-dom";
export default function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/">
<Route
index
element={
<div>
<p>Home</p>
<Link to="settings">Settings</Link>
</div>
}
/>
<Route path="settings">
<Route
index
element={
<div>
<p>Settings</p>
<p>
<Link to="account">Account Settings</Link>
</p>
<p>
{/* Why does this need ../.. instead of just .. to work? */}
<Link to="../..">Go back</Link>
</p>
</div>
}
/>
<Route
path="account"
element={
<div>
<p>Account Settings</p>
<Link to="..">Go back</Link>
</div>
}
/>
</Route>
</Route>
</Routes>
</BrowserRouter>
);
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I am also having this issue. Did you manage to find a solution to this ? |
Beta Was this translation helpful? Give feedback.
-
This should be resolved in |
Beta Was this translation helpful? Give feedback.
This should be resolved in
6.4.0
- see #8350 👍