Last active
December 1, 2018 17:43
-
-
Save Jahans3/7c75d1169e95b6e0b1a3668ea6c59143 to your computer and use it in GitHub Desktop.
Count reducer
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
function countReducer ({ count, ...state }, { type, payload }) { | |
switch (type) { | |
case ADD_N: | |
return { ...state, count: count + payload }; | |
case ADD_ONE: | |
return { ...state, count: count + 1 }; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment