T
TanStack2y ago
xenial-black

Accessing route data outside react components and hooks

Is there a way to access route's data (and params and searchparams, etc...) outside react components and hooks like there is for tanstack query via getQueryData?
2 Replies
optimistic-gold
optimistic-gold2y ago
I think just calling router.state.matches on your router will get you quite far there, each match has a loaderData for example
xenial-black
xenial-blackOP2y ago
yeah, that's what i needed, thanks. Is there an example in the docs about this?

Did you find this page helpful?