Open History to see the last commit
1---
2id: useIsMutating
3title: useIsMutating
4---
5β
6`useIsMutating` is an optional hook that returns the `number` of mutations that your application is fetching (useful for app-wide loading indicators).
7β
8```tsx
9import { useIsMutating } from '@tanstack/react-query'
10// How many mutations are fetching?
11const isMutating = useIsMutating()
12// How many mutations matching the posts prefix are fetching?
13const isMutatingPosts = useIsMutating({ mutationKey: ['posts'] })
14```
15β
16**Options**
17β
18- `filters?: MutationFilters`: [Mutation Filters](../../../../framework/react/guides/filters#mutation-filters)
19- `context?: React.Context<QueryClient | undefined>`
20 - Use this to use a custom React Query context. Otherwise, `defaultContext` will be used.
21β
22**Returns**
23β
24- `isMutating: number`
25 - Will be the `number` of the mutations that your application is currently fetching.