Skip to content

Instantly share code, notes, and snippets.

@jamestthompson3
Created June 3, 2018 09:32
Show Gist options
  • Save jamestthompson3/39f28c84bed7ad28fdf8738f1bbdba61 to your computer and use it in GitHub Desktop.
Save jamestthompson3/39f28c84bed7ad28fdf8738f1bbdba61 to your computer and use it in GitHub Desktop.
const LikesList = ({
user: { likes, user },
updateFunctions: { addLike, deleteLike }
}) => (
<Fragment>
<ListHeader>
<h3 style={{ margin: 0 }}>Likes</h3>
<i className="material-icons" style={{ cursor: 'pointer' }} >
add
</i>
</ListHeader>
<LikesContainer style={{ marginBottom: 20 }}>
{likes.map(like => (
<ListItem open={isOpen} key={like.item + like.id}>
{like.item}
<i className="material-icons" onClick={() => deleteLike(user, like)}>
delete
</i>
</ListItem>
))}
</LikesContainer>
</Fragment>
)
const Likes = compose(
getContext({ updateFunctions: PropTypes.object, user: PropTypes.object })
)(LikesList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment