Created
May 31, 2021 01:43
-
-
Save jinook929/e0df4f59a7c8cd085d2f4b361f75cca4 to your computer and use it in GitHub Desktop.
React with Hooks, with Redux: reducer/index.js
This file contains 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
const countReducer = (state = {count: 0}, action) => { | |
switch(action.type) { | |
case "INCREASE_COUNT": | |
return {...state, count: action.payload} | |
case "DECREASE_COUNT": | |
return {...state, count: action.payload} | |
case "RESET_COUNT": | |
return {...state, count: action.payload} | |
default: | |
return state | |
} | |
} | |
export default countReducer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment