useParams not working
hey, I wanted to have my fetch functions for resources in separate file but when I use useParams inside of the fetch function it works just fine the first time but if I switch to different route it returns a proxy object with no params
in my layout its not detecting the params even though its there
SidePanel.jsx:
14 Replies
params is always empty proxy object, and params.guildID is undefined
The SidePanel component is in DashboardLayout layout
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
no, i never used codesandbox and never heard of stackblitz
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
here is a showcase of whats happening
forgot to show the routes
I expect to have params in the SidePanel component. I'm aware that the SidePanel component is part of DashboardLayout and that is rendered on route /dashboard but it has an outlet component which allows me to show stuff on different routes. What I think is happening here is that the SidePanel component (along with DashboardLayout) thinks that they are only on /dashboard route even though they are at /dashboard/:guildID(/leaderboard)
your stackblitz example works because you have the guildID in the <A> href "hardcoded" I need it dynamic based on the route
damn I found the issue
I had to restructure my routes like so
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View