Skip to content

How to refetch only if stale during screen focus in react native? #9554

Answered by imadselka
heisenbugged asked this question in Q&A
Discussion options

You must be logged in to vote

instead of calling refetch() everywhere, do:

  queryClient.refetchQueries({ stale: true, type: 'active' })

This way only queries older than their staleTime will refetch.

#4016

Replies: 1 comment 1 reply

Comment options

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

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