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