What prompts `useQuery` to refetch?
When using
useQuery, does it automatically detect (with query keys) whether or not it should refetch again? If I have a useQuery at the top of a component, it will fetch when the component is rendered. If the component is re-rendered, would it fetch again? Or it would check first if the data in the cache is stale, and if so, it will only refetch then. Is this the case?2 Replies
fair-rose•4y ago
a mere re-render will never trigger a refetch. The points in time where stale data is refetched are:
- new mount of a component
- window focus
- network reconnect
rare-sapphireOP•4y ago
hmm, I see, thank you