-
We have noticed that, with a structure like this: function Foo() {
const [location] = useLocation();
return <div>Location is: '{location}'</div>
}
function Home() {
const [location] = useLocation();
return <div>Location is: '{location}'</div>
}
function App() {
return (
<Route path="/the-prefix" nest>
<Switch>
<Route path="/foo">
<Foo />
</Route>
<Route path="">
<Home />
</Route>
</Switch>
</Route>
)
} If you visit On the other hand, if you visit We imagine this is related with this logic, which falls back empty strings to |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, here is how matching works by default:
|
Beta Was this translation helpful? Give feedback.
-
Also, we assume that |
Beta Was this translation helpful? Give feedback.
Also, we assume that
""
is not a valid location and it should always start with a slash. This simplifies many things internally such as relative routes, nesting etc.