Skip to content

Instantly share code, notes, and snippets.

@narennaik
Created August 1, 2021 09:20
Show Gist options
  • Save narennaik/7f691081e25fd2dd95879d15429833ca to your computer and use it in GitHub Desktop.
Save narennaik/7f691081e25fd2dd95879d15429833ca to your computer and use it in GitHub Desktop.
reducer
const reducer = (state, action) => {
if (action.type === 'ADD_TODO') {
return { ...state, todo: [...state.todo, action.payload] };
} else {
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment