Removing a comment from view

When a comment's delete button is clicked by the commenter, the Comments component will call the deleteComment method to fetch the uncomment API, and update the comments along with the comment count when the comment is successfully removed from the server.

mern-social/client/post/Comments.js:

deleteComment = comment => event => {    const jwt = auth.isAuthenticated()    uncomment({      userId: jwt.user._id    }, {      t: jwt.token    }, this.props.postId, comment).then((data) => {      if (data.error) {        console.log(data.error)      } else {        this.props.updateComments(data.comments)      }    })  }

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.