Skip to content

Instantly share code, notes, and snippets.

@mfp22
Last active November 11, 2017 19:55
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 mfp22/9f535dc61f483515e30f8679e8f8f57f to your computer and use it in GitHub Desktop.
Save mfp22/9f535dc61f483515e30f8679e8f8f57f to your computer and use it in GitHub Desktop.
export function favoriteItemsReducer(state = initialState, action: Action) {
switch(action.type) {
case 'REMOVE_FAVORITE_ITEM':
case 'DELETE_ITEM_SUCCESS':
const itemId = action.payload;
return state.filter(id => id !== itemId);
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment