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