React Query: derived boolean flags
2 November 2023 (Updated 2 November 2023)
On this page
In a nutshell
useQuery
gives you a number of derived boolean flags:
isFetching
:true
when the query is executing, whether it’s the initial fetch or subsequent background fetches.isPending
:true
when there is no cached data and no query attempt has finished yet.isLoading
:true
when the first request for a query is in-flight. Same asisFetching && isPending
.isRefetching
:true
when a background refetch is in-flight. It doesn’t equaltrue
when the initial fetch is in-flight.
Sources
Tagged:
React Query
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment