Open History to see the last commit
1---
2id: useIsFetching
3title: useIsFetching
4redirect_from:
5 - framework/solid/reference/useIsFetching
6---
7β
8```ts
9function useIsFetching(filters?: Accessor<QueryFilters<readonly unknown[]>>, queryClient?: Accessor<QueryClient>): Accessor<number>;
10```
11β
12Defined in: [packages/solid-query/src/useIsFetching.ts:27](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useIsFetching.ts#L27)
13β
14The `useIsFetching` primitive returns the `number` of the queries that your application is loading or fetching
15in the background (useful for app-wide loading indicators).
16β
17## Parameters
18β
19### filters?
20β
21`Accessor`\<[`QueryFilters`](../interfaces/QueryFilters.md)\<readonly `unknown`[]\>\>
22β
23An accessor returning the [QueryFilters](../interfaces/QueryFilters.md) to narrow down the matched queries.
24β
25<a id="filters-properties"></a>
26β
27#### `filters` properties
28β
29Built from [`QueryFilters`](../interfaces/QueryFilters.md#properties). See the type above for what it changes.
30β
31### queryClient?
32β
33`Accessor`\<[`QueryClient`](../classes/QueryClient.md)\>
34β
35An accessor for a custom `QueryClient`. Otherwise, the one from the nearest context
36will be used.
37β
38## Returns
39β
40`Accessor`\<`number`\>
41β
42An accessor for the `number` of the queries that your application is currently loading or fetching
43in the background.
44β
45## Example
46β
47```tsx
48import { useIsFetching } from '@tanstack/solid-query'
49β
50function GlobalLoadingIndicator() {
51 // How many queries matching the posts prefix are fetching?
52 const isFetchingPosts = useIsFetching(() => ({ queryKey: ['posts'] }))
53β
54 return isFetchingPosts() > 0 ? <span>Loading posts...</span> : null
55}
56```