T
TanStack12mo ago
exotic-emerald

How to access cached data from React Query in a different component?

I have fetched data using useQuery in one component, and now I need access to that same data in another component that is not a child of the first component. Should I refetch the data in the second component, or is there a way to access the cached data from React Query without refetching it?
2 Replies
rising-crimson
rising-crimson12mo ago
you can just useQueryagain there
rising-crimson
rising-crimson12mo ago
React Query as a State Manager
Everything you need to know to make React Query your single source of truth state manager for your async state

Did you find this page helpful?