Skip to content

Commit dae15cc

Browse files
authored
docs: update usage example.
Somehow lost these changes from #70 (review)
1 parent 288308e commit dae15cc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ import { useOptimisticMutation } from "@tanstack/react-optimistic"
8080
const AddTodo = () => {
8181
const addTodo = useOptimisticMutation({
8282
mutationFn: async ({ transaction }) => {
83-
const { collection, ...newTodo } = transaction.mutations[0]!
83+
const { collection, modified: newTodo } = transaction.mutations[0]!
8484

85-
await axios.post("/api/todos", newTodo)
85+
await api.todos.create(newTodo)
8686
await collection.invalidate()
8787
},
8888
})

0 commit comments

Comments
 (0)