I am starting to learn ReactQuery. I’ve gone through multiple articles which mentioned that data won’t re-fetch when staleTime: Infinity and cacheTime: 0. I would like to understand how this works.
From my understanding, cacheTime is the time till which the data stays in the cache before it is garbage collected/deleted. In this case as the cacheTime is set to zero, when there is component unmount, the cached data is garbage collected immediately.
Now if there is window refocus (or any trigger point), as there is no data to be fetched from cache so how is it possible to not make a re-fetch and still have the data?
I read multiple articles on React Query but couldn’t help myself.
PavitraK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.