doc mutations

This commit is contained in:
Yanick Champoux 2023-03-02 14:03:01 -05:00
parent ea724ab73b
commit 29d3d9a2aa

View File

@ -69,11 +69,10 @@ console.log( todosDux.actions.addTodo('write tutorial') );
### Adding a mutation
Mutations are the reducing functions associated to actions. They
are defined via the `setMutation` method:
are defined via the `mutation` method:
```js
todosDux.setMutation( 'addTodo', description => ({next_id: id, todos}) => ({
todosDux.mutation( addTodo, description => ({next_id: id, todos}) => ({
next_id: 1 + id,
todos: [...todos, { description, id, done: false }]
}));