State Management · Middle · Question 26 of 75
How does staleTime differ from gcTime?
- ✓Correct answer:
staleTimeis how long data counts as fresh;gcTimeis how long unused data stays in memory - 2They're synonyms;
gcTimeis the new name in v5 - 3
staleTimeis the request timeout;gcTimeis the retry delay
Explanation
Fresh data isn't refetched on mount or focus. Stale data is still shown from cache and refreshed in the background. gcTime (formerly cacheTime, 5 minutes by default) starts when the query has no observers.