Skip to content

Commit 799eb90

Browse files
authored
docs: mutationFn should return a Promise type (#854)
1 parent b8a0b99 commit 799eb90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/src/pages/docs/guides/mutations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Note that since version 1.1.0, the `mutate` function is no longer called synchro
8787
const CreateTodo = () => {
8888
const [mutate] = useMutation(event => {
8989
event.preventDefault()
90-
fetch('/api', new FormData(event.target))
90+
return fetch('/api', new FormData(event.target))
9191
})
9292

9393
return <form onSubmit={mutate}>...</form>
@@ -96,7 +96,7 @@ const CreateTodo = () => {
9696
// This will work
9797
const CreateTodo = () => {
9898
const [mutate] = useMutation(formData => {
99-
fetch('/api', formData)
99+
return fetch('/api', formData)
100100
})
101101
const onSubmit = event => {
102102
event.preventDefault()

0 commit comments

Comments
 (0)