Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Last active January 10, 2019 16:05
Embed
What would you like to do?
const todoListReducer = (
state: string[],
action: { type: string; value: string }
) => {
switch (action.type) {
case "ADD":
return [...state, action.value];
case "REMOVE":
return state.filter((todo: string) => todo !== action.value);
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment