How to navigate to basename (root route)? #10679
-
Let's say I have this structure: function App() {
return (
<BrowserRouter basename="/backend">
<Routes>
<Route path="/">
<Route
path="page1"
element={<Page1 />} />
</Route>
</Routes>
</BrowserRouter>
);
} and the url is currently at Somewhere inside How can I achieve that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
What version of react router are you using? We did some work a while back to let you control this via inclusion or exclusion in
If it's not working on the latest for you could you provide a reproduction? It seemed to work for me in a quick local test. |
Beta Was this translation helpful? Give feedback.
What version of react router are you using? We did some work a while back to let you control this via inclusion or exclusion in
basename
:<BrowserRouter basename="/backend">
would make<Link to="/">
go to/backend
<BrowserRouter basename="/backend/">
would make<Link to="/">
go to/backend/
If it's not working on the latest for you could you provide a reproduction? It seemed to work for me in a quick local test.