Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions website/docs/example-setstate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const TodoList = () => {
break
case "add":
draft.push({
id: "todo_" + Math.random(),
id: action.id,
title: "A new todo",
done: false
})
Expand All @@ -163,7 +163,8 @@ const TodoList = () => {

const handleAdd = useCallback(() => {
dispatch({
type: "add"
type: "add",
id: "todo_" + Math.random()
})
}, [])

Expand All @@ -189,7 +190,7 @@ const TodoList = () => {
break;
case "add":
draft.push({
id: "todo_" + Math.random(),
id: action.id,
title: "A new todo",
done: false
});
Expand Down Expand Up @@ -227,7 +228,7 @@ const todosReducer = produce((draft, action) => {
break
case "add":
draft.push({
id: "todo_" + Math.random(),
id: action.id,
title: "A new todo",
done: false
})
Expand Down