Skip to content

Instantly share code, notes, and snippets.

@santiagopoli
Created April 30, 2017 19:21
Show Gist options
  • Select an option

  • Save santiagopoli/b78be33a72a6adbd0a54165ca1804188 to your computer and use it in GitHub Desktop.

Select an option

Save santiagopoli/b78be33a72a6adbd0a54165ca1804188 to your computer and use it in GitHub Desktop.
const clear = (favoriteId) => state => ...
const fetching = (favoriteId) => state => ...
const finishFetching = (favoriteId, favorite) => state => ...
export default (state = {}, action) => {
switch (action.type) {
case 'CLEAR_FAVORITE':
return clear(action.favoriteId)(state);
case 'FETCHING_FAVORITE':
return fetching(action.favoriteId)(state);
case 'FINISH_FETCHING_FAVORITE':
return finishFetching(action.favoriteId, action.favorite)(state);
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment