Skip to content

Instantly share code, notes, and snippets.

Last active January 10, 2019 16:05
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);
return state;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment