React Query: isInitialLoading
30 May 2023 (Updated 30 May 2023)
On this page
In a nutshell
isInitialLoading
is a new flag of the useQuery
hook that was released in v4. It’s derived from:
isLoading && isFetching
You’ll want to use isInitialLoading
instead of isLoading
if you want to check whether a disabled query is currently fetching or not in version 4 of React Query.
In version 3, disabled queries started off in the idle state, but in version 4 they start off in the loading state. This means that if you now want to check if a disabled query is active (i.e., is fetching), you’ll want to use isInitialLoading
instead of isLoading
.
Sources
Tagged:
React Query
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment