Skip to content

Commit

Permalink
add missing round brackets
Browse files Browse the repository at this point in the history
I am afraid that those round brackets are necessary to run an example.
  • Loading branch information
sppiotrowski authored and timche committed May 3, 2018
1 parent 33d6443 commit 518cf42
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/introduction/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ const decrement = createAction('DECREMENT');
Instead of using `handleAction` like we did for `increment`, we can replace it with our other tool `handleActions` which will let us handle both `increment` and `decrement` actions.

```js
const {
createAction,
handleActions
} = window.ReduxActions;

const reducer = handleActions({
[increment]: (state) => ({ ...state, counter: state.counter + 1 },
[decrement]: (state) => ({ ...state, counter: state.counter - 1 },
}, defaultState);
const { createAction, handleActions } = window.ReduxActions;

const reducer = handleActions(
{
[increment]: state => ({ ...state, counter: state.counter + 1 }),
[decrement]: state => ({ ...state, counter: state.counter - 1 })
},
defaultState
);
```

Now when we add a handler for dispatching our `decrement` action we can see both `increment` and `decrement` buttons now function appropriately.
Expand Down

0 comments on commit 518cf42

Please sign in to comment.