T
TanStack8mo ago
foreign-sapphire

Using Router with React Context/Hooks

I used the examples in the docs to set up my React context and hooks so that they run before Router and inject the values into the Router context. However, now I have a chicken and egg problem, where I need some of the URL params in my hooks (I used useMatches from React Router), but I don't have access to the router to get those params. And when I manually try to extract different params with regex (very hacky, not scaleable), I still get issues of race conditions when navigating directly to a deeply nested page (e.g. /users/1/payments/invoices/2/categories/3
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?