Skip to content

Instantly share code, notes, and snippets.

@Jahans3 Jahans3/count-reducer.js
Last active Dec 1, 2018

Embed
What would you like to do?
Count reducer
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
You can’t perform that action at this time.