---
id: mutations
title: Mutations
ref: docs/framework/react/guides/mutations.md
---
[//]: # 'Example'
```vue
Adding todo...
An error occurred: {{ error.message }}
Todo added!
```
[//]: # 'Example'
[//]: # 'Info1'
[//]: # 'Info1'
[//]: # 'Example2'
[//]: # 'Example2'
[//]: # 'Example3'
```vue
An error occurred: {{ error.message }}
```
[//]: # 'Example3'
[//]: # 'Example11'
```js
const client = new QueryClient({
defaultOptions: {
queries: {
gcTime: 1000 * 60 * 60 * 24, // 24 hours
},
},
})
// we need a default mutation function so that paused mutations can resume after a page reload
queryClient.setMutationDefaults({
mutationKey: ['todos'],
mutationFn: ({ id, data }) => {
return api.updateTodo(id, data)
},
})
const vueQueryOptions: VueQueryPluginOptions = {
queryClient: client,
clientPersister: (queryClient) => {
return persistQueryClient({
queryClient,
persister: createAsyncStoragePersister({ storage: localStorage }),
})
},
clientPersisterOnSuccess: (queryClient) => {
queryClient.resumePausedMutations()
},
}
createApp(App).use(VueQueryPlugin, vueQueryOptions).mount('#app')
```
[//]: # 'Example11'
[//]: # 'Materials'
[//]: # 'Materials'