We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2af581 commit 0789c4fCopy full SHA for 0789c4f
docs/api/createReducer.md
@@ -84,14 +84,15 @@ const todosReducer = createReducer([], {
84
[addTodo]: (state, action) => {
85
// This push() operation gets translated into the same
86
// extended-array creation as in the previous example.
87
- state.push(todo)
+ const todo = action.payload
88
+ state.push(todo)
89
},
90
[toggleTodo]: (state, action) => {
91
// The "mutating" version of this case reducer is much
92
// more direct than the explicitly pure one.
93
const index = action.payload
- const todo = state[index]
94
- todo.completed = !todo.completed
+ const todo = state[index]
95
+ todo.completed = !todo.completed
96
}
97
})
98
```
0 commit comments