useReply
Introduction
The useReply
is a custom hook that provides the details regarding the comments and replies.
This takes 3 arguments, postId
, commentId
and post
object.
Property | Type | Description |
---|---|---|
reply | Reply | null | The current reply or null if no reply is selected. |
users | Record<string, User> | A map of user IDs to user objects. |
loadMoreReplies | boolean | Flag indicating if more replies can be loaded. |
getNextPage | () => Promise<void> | Function to fetch the next page of replies. |
replies | Reply[] | Array of replies. |
deleteReply | (id: string) => Promise<void> | Function to delete a reply by its ID. |
likeReply | (id: string) => Promise<void> | Function to like a reply by its ID. |
updateReply | (comment: Reply, usersMap: Record<string, User>) => void | Function to update a reply and the associated users map. |
Example
For example implementation, checkout here