doc mutations
This commit is contained in:
parent
ea724ab73b
commit
29d3d9a2aa
@ -69,11 +69,10 @@ console.log( todosDux.actions.addTodo('write tutorial') );
|
|||||||
### Adding a mutation
|
### Adding a mutation
|
||||||
|
|
||||||
Mutations are the reducing functions associated to actions. They
|
Mutations are the reducing functions associated to actions. They
|
||||||
are defined via the `setMutation` method:
|
are defined via the `mutation` method:
|
||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
todosDux.setMutation( 'addTodo', description => ({next_id: id, todos}) => ({
|
todosDux.mutation( addTodo, description => ({next_id: id, todos}) => ({
|
||||||
next_id: 1 + id,
|
next_id: 1 + id,
|
||||||
todos: [...todos, { description, id, done: false }]
|
todos: [...todos, { description, id, done: false }]
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user