Skip to content

Instantly share code, notes, and snippets.

@GoudekettingRM
Last active August 23, 2020 13:25
Show Gist options
  • Save GoudekettingRM/4741fb23fc2ade02dc59470d0bcbc5da to your computer and use it in GitHub Desktop.
Save GoudekettingRM/4741fb23fc2ade02dc59470d0bcbc5da to your computer and use it in GitHub Desktop.
case SET_IMAGE_LIKE: {
if (action.payload) {
return {
...state,
allImages: state.allImages.map((image) => {
if (image.id === action.payload.imageId) {
image.likes = [...image.likes, action.payload];
return image;
} else {
return image;
}
}),
};
} else {
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment