T
TanStack17mo ago
adverse-sapphire

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
rival-black
rival-black17mo ago
I think just calling router.state.matches on your router will get you quite far there, each match has a loaderData for example
adverse-sapphire
adverse-sapphireOP17mo ago
yeah, that's what i needed, thanks. Is there an example in the docs about this?

Did you find this page helpful?