Skip to content

Commit 7ad3678

Browse files
authored
Return Statement
I know everyone loves the one-liner code. It looks awesome! But in this certain case, I thought newTodo is the second argument to useMutation hook which was very confusing for me when I tried to code and it didn't work. It took me a very long time to notice that small detail. I I think the return statement will drastically remove that confusion. `useMutation(newTodo => axios.post('/todos', newTodo))`
1 parent f7854e0 commit 7ad3678

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/src/pages/guides/mutations.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Here's an example of a mutation that adds a new todo to the server:
99

1010
```js
1111
function App() {
12-
const mutation = useMutation(newTodo => axios.post('/todos', newTodo))
12+
const mutation = useMutation(newTodo => {
13+
return axios.post('/todos', newTodo)
14+
})
1315

1416
return (
1517
<div>

0 commit comments

Comments
 (0)