Skip to content

Instantly share code, notes, and snippets.

@manojsinghnegiwd
Created April 20, 2021 11:44
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 manojsinghnegiwd/983ca3b6e5a2f30e6587dc5d7c2e727c to your computer and use it in GitHub Desktop.
Save manojsinghnegiwd/983ca3b6e5a2f30e6587dc5d7c2e727c to your computer and use it in GitHub Desktop.
const initialState = { count: 0 };
function reducer(state, action) {
switch (action.type) {
case "increment":
return { count: state.count + 1 };
case "decrement":
return { count: state.count - 1 };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment