sajad torkamani

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

Leave a comment

Your email address will not be published. Required fields are marked *