@@ -4,7 +4,7 @@ Here's an example of a mutation that adds a new todo to the server:
44
55``` vue
66<script setup>
7- import { useQuery } from "vue-query";
7+ import { useMutation } from "vue-query";
88
99function useAddTodoMutation() {
1010 return useMutation((newTodo) => axios.post("/todos", newTodo));
@@ -47,7 +47,7 @@ It's sometimes the case that you need to clear the `error` or `data` of a mutati
4747
4848``` vue
4949<script>
50- import { useQuery } from "vue-query";
50+ import { useMutation } from "vue-query";
5151
5252function useAddTodoMutation() {
5353 return useMutation((newTodo) => axios.post("/todos", newTodo));
@@ -111,10 +111,10 @@ function useAddTodoMutation() {
111111}
112112```
113113
114- You might find that you want to ** trigger additional callbacks** than the ones defined on ` useMutation ` when calling ` mutate ` .
115- This can be used to trigger component-specific side effects.
116- To do that, you can provide any of the same callback options to the ` mutate ` function after your mutation variable.
117- Supported overrides include: ` onSuccess ` , ` onError ` and ` onSettled ` .
114+ You might find that you want to ** trigger additional callbacks** than the ones defined on ` useMutation ` when calling ` mutate ` .
115+ This can be used to trigger component-specific side effects.
116+ To do that, you can provide any of the same callback options to the ` mutate ` function after your mutation variable.
117+ Supported overrides include: ` onSuccess ` , ` onError ` and ` onSettled ` .
118118Please keep in mind that those additional callbacks won't run if your component unmounts ** before** the mutation finishes.
119119
120120``` js
0 commit comments