Last active
August 23, 2020 13:25
-
-
Save GoudekettingRM/4741fb23fc2ade02dc59470d0bcbc5da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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