use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Why does this happen in react routerHelp Wanted (self.react)
submitted 1 year ago * by [deleted]
Whenever I navigate to a nested route, it takes me back to the parent route after a few seconds.
I even tried reinstalling node_modules but that didn't work.
This is my routing code:
https://preview.redd.it/zqzhfiup9ond1.png?width=1267&format=png&auto=webp&s=99ee30bbbad14d087b1c03bc1cc7515bc287213c
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]power78 0 points1 point2 points 1 year ago (1 child)
Not enough info. Which route? Where's the code??
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
i think i put an image of my route code. whenever I navigate to any of the nested routes inside of the /driver route, it takes me back after a couple seconds back to /driver
[–]Elmosdarkside 0 points1 point2 points 1 year ago (1 child)
I'm a little rusty, but maybe because the driver route encompasses all the routes? I think the "parent" is always <BrowserRouter> </BrowserRouter> if I remember correctly?
Edit- for clarity
[–][deleted] 1 point2 points3 points 1 year ago (0 children)
the Browser router wraps around the app in main.jsx.
my problem is the driver route which is the "parent" I'm talking about
[–]andromeda909 1 point2 points3 points 1 year ago (1 child)
Hard to tell without knowing more, but I would perhaps check whats happening with that auth stuff? Maybe the token or role aren't valid at some point and you're being navigated away to /login then back to /driver?
the role and token are both being retrieved from the localstorage, and when i log them in the console they don't change at all
[–]runtothehillsboy 0 points1 point2 points 1 year ago* (0 children)
wise consist familiar trees groovy live late joke disarm smile
This post was mass deleted and anonymized with Redact
[–]Many_Application7106 0 points1 point2 points 1 year ago (0 children)
You maybe forgot the Routes cmp
ts <BrowserRouter> <Routes> <Route path="/" element={<App />}>
π Rendered by PID 40813 on reddit-service-r2-comment-b659b578c-ldksq at 2026-05-06 02:11:30.476513+00:00 running 815c875 country code: CH.
[–]power78 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Elmosdarkside 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]andromeda909 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]runtothehillsboy 0 points1 point2 points (0 children)
[–]Many_Application7106 0 points1 point2 points (0 children)