Skip to main content

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.

PropertyTypeDescription
replyReply | nullThe current reply or null if no reply is selected.
usersRecord<string, User>A map of user IDs to user objects.
loadMoreRepliesbooleanFlag indicating if more replies can be loaded.
getNextPage() => Promise<void>Function to fetch the next page of replies.
repliesReply[]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>) => voidFunction to update a reply and the associated users map.

Example

For example implementation, checkout here