React router dom is not redirecting to the route even though the url is changed

Hey I am facing a error. when I try to log in with my admin account on a website I am working in. The url changes but it doesn't redirect me to the admin dashboard. If I reload the website then I will be redirected to the admin dashboard and the issue won't come in if I don't reload after logging out. Why am I getting this error and how to fix it ?
7 Replies
missymae#2783
missymae#2783β€’5mo ago
I guess some problem with how you've written your router or outlet. Maybe something isn't nested correctly. But you will need to share actual code for anyone to suggest a fix.
dysbulic πŸ™
dysbulic πŸ™β€’5mo ago
Are you using <Link> tags?
Manish Karki
Manish Karkiβ€’5mo ago
No I am checking the type of user and then navigating to their dashboard with useNavigate hook Which codes should I post? I mean of which component ?
dysbulic πŸ™
dysbulic πŸ™β€’5mo ago
Try useHistory. (Or maybe not. I've got to figure out which documentation I'm looking at…)
Manish Karki
Manish Karkiβ€’5mo ago
Can't use useHistory
dysbulic πŸ™
dysbulic πŸ™β€’5mo ago
Yeah, I was in the wrong documentation, sorry. <:sad_google:400614345672884234>
Manish Karki
Manish Karkiβ€’5mo ago
This issue only comes when in the beggining or if I refresh page when I logged out. Otherwise it works fine.
Want results from more Discord servers?
Add your server
More Posts
Seeking Assistance: Centering Issue with Flexbox HeaderHi, I hope you all are doing well. I am writing code for a little design. However, I am facing an iJumping for characterHello, I am having an issue with making a jumping animation for my character. Here is the code: ```Can some review my attempt at this coding challenge?I deployed it on GitHub pages This is the URL. https://davesamuels1998.github.io/Newsletter-sign-up-overflowing text in grid areacurrently trying to troubleshoot this one: I have a grid of columns, where each item is a grid of immax-width media query not applying to max valueI have an odd issue where my max-width media query; eg: `@media (max-width: 1023px)` is working on e[React] How does this code look to you?Friend and I spent a few hours yesterday trying to get setInterval and useEffect to work on our littI have the following code how I can make contaniner_contant class closer to background_countainerin the following code https://codesandbox.io/p/sandbox/layout-page-8gvxls you can see there space Background color changes dimensions ???Can anyone explain me why thus happens ? Is there something in the tailwind I do not understand :/ Whaving a scrollbar without setting heightOn mobile, when the menu opens, it overflows the screen size. Setting `overflow-y: scroll` doesnt wobefore unload event - how to change default message "Changes you made may not be saved"?I created issue - so it would be cool if you know hot to show custom message and answer there https: