In this section we want to add the functionality of commenting under the news.
First we need to update the fields of
usePost in the
NewsPage.tsx to retrieve the replies.
Now we can create our CommentList component.
We are also getting the
authMemberProps for the replies, therefore we can easily reuse our
to have the functionality of deleting comments.
useAddReply hook to reply to a post. We can easily create a component that comments under a post.
We used the id of the "Comment" post type. If you are using your own community
postTypes query to find the id of the "Comment" post type.
Now we can easily add these components to our NewsPage component.
Now it's all set. You can start viewing, adding, and deleting comments.
You can see the final result here.