When using search parameters in a nested React route, when I'm on /app, and after clicking the link that navigates to /app/user, the navigation doesn't work.
If I try to use without nesting, it works. But why it doesn't work when nested.
Codesandbox: CodeSandBox link
<Routes> <Route path="/" element={<LandingPage />} /> <Route path="/app" element={<Main />}> <Route path=":user" element={<User />} /> </Route> <Route path="*" element={<PageNotFound />} /> </Routes>
try it
If you want to nest the
User.js
component, you need to addOutlet
in
Main.js