Created
October 28, 2018 06:09
-
-
Save ryardley/17da8e6a19b9ab7043c7fda77d42d609 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
const Comments = ({ repoFullName }) => ( | |
<Mutation mutation={DELETE_COMMENT}> | |
{(deleteComment) => ( | |
<Query query={GET_CURRENT_USER}> | |
{({data: {currentUser}}) => ( | |
<Subscription | |
subscription={COMMENTS_SUBSCRIPTION} | |
variables={{ repoFullName }}> | |
{({ data: { commentAdded }, loading }) => ( | |
<div> | |
<h3>Hi {currentUser.name}</h3> | |
<h4>New comment: {!loading && commentAdded.content}</h4> | |
<Button onClick={() => deleteComment({variables: {commentId:commentAdded.id}})}>Delete Comment</Button> | |
</div> | |
)} | |
</Subscription> | |
)} | |
</Query> | |
)} | |
</Mutation> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment