Open History to see the last commit
1---
2id: useIsFetching
3title: useIsFetching
4---
5β
6`useIsFetching` is an optional hook that returns the `number` of the queries that your application is loading or fetching in the background (useful for app-wide loading indicators).
7β
8```tsx
9import { useIsFetching } from '@tanstack/react-query'
10// How many queries are fetching?
11const isFetching = useIsFetching()
12// How many queries matching the posts prefix are fetching?
13const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })
14```
15β
16**Options**
17β
18- `filters?: QueryFilters`: [Query Filters](../guides/filters.md#query-filters)
19- `queryClient?: QueryClient`
20 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
21β
22**Returns**
23β
24- `isFetching: number`
25 - Will be the `number` of the queries that your application is currently loading or fetching in the background.