Skip to content

Accessing the same cache from multiple components #1313

Answered by TkDodo
Jake-Prentice asked this question in Q&A
Discussion options

You must be logged in to vote

The recommended way would be to just call useQuery again, or abstract the useQuery away in a custom useQuizzesQuery hook and call that whenever you need the data. React query will give you the data from the cache and subscribe you to it, and also perform a background refetch when the component mounts.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@Jake-Prentice
Comment options

@Jake-Prentice
Comment options

@TkDodo
Comment options

@Jake-Prentice
Comment options

@John-Paul-R
Comment options

Answer selected by Jake-Prentice
Comment options

You must be logged in to vote
1 reply
@TkDodo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants