Skip to content

Instantly share code, notes, and snippets.

@syamjayaraj
Last active December 7, 2018 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syamjayaraj/72ea8292a0a28c199f1872baeceed52d to your computer and use it in GitHub Desktop.
Save syamjayaraj/72ea8292a0a28c199f1872baeceed52d to your computer and use it in GitHub Desktop.
const initialState = {
count: 0,
}
function CounterReducer (state = initialState, action){
switch(action.type){
case "INCREMENT_COUNT": {
return {...state, ...action}
}
case "DECREMENT_COUNT": {
return {...state, ...action}
}
default:
return state
}
}
export default CounterReducer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment