Closed
Description
https://redux-toolkit.js.org/tutorials/intermediate-tutorial
...I prefer always having payload be an object, so I made it action.payload.id instead
However, the actual code snippet this is referring to does not use action.payload.id
It uses action.payload directly:
toggleTodo(state, action) {
const todo = state.find(todo => todo.id === action.payload)
if (todo) {
todo.completed = !todo.completed
}
}
Metadata
Metadata
Assignees
Labels
No labels