Course lesson
Configure staleTime within React Query
In queryOptions you can set the staleTime of a query to set how long it takes for data to be considered stale and warrant a refetch.
- Duration
- 3 min
- Access
- Included
- Transcript
- Retained from source evidence
In queryOptions you can set the staleTime of a query to set how long it takes for data to be considered stale and warrant a refetch.
By default, React Query sets this value to 0.
But, different queries will need different times set depending on how often the data on the server is being updated.