Created
December 20, 2018 14:08
-
-
Save darrenmothersele/14497986a31677af6c6584b7d2203faa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Actions } from './counter.actions'; | |
| import produce from 'immer'; | |
| export const initialState = 0; | |
| const producer = (draft, action) => Actions.match(action, { | |
| Increment: () => draft + 1, | |
| Decrement: () => draft - 1, | |
| Reset: () => initialState, | |
| default: () => {} | |
| }); | |
| export const counterReducer = produce(producer, initialState); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment