Skip to main content

useLMFeedDetails

Introduction

The useLMFeedDetails is a custom React hook that provides detailed information about a specific feed-post in the LikeMinds Feed application. This hook requires a id of a post as a parameter. Developers can use this hook to define a custom component for a feed details page, while delegating all the data related work to this hook.

PropertyTypeDescription
postPost | nullThe post object or null if not available.
usersRecord<string, User>A record of user objects indexed by user ID.
getNextPage() => Promise<void>Function to fetch the next page of feed details.
loadNextPagebooleanFlag indicating whether the next page is being loaded.
repliesReply[]Array of reply objects associated with the post.
topicsRecord<string, Topic>A record of topic objects indexed by topic ID.
widgetsRecord<string, any>A record of widget objects indexed by widget ID.
addNewComment(comment: Reply, userMap: Record<string, User>) => voidFunction to add a new comment to the post.
removeAComment(id: string) => voidFunction to remove a comment by its ID.
updateReplyOnPostReply(id: string) => voidFunction to update a reply when a post reply is made.
updateReply(comment: Reply, usersMap: Record<string, User>) => voidFunction to update a reply with new data.
likeReply(id: string) => Promise<void>Function to like a reply by its ID.
likePost(id: string) => Promise<void>Function to like a post by its ID.
pinPost(id: string) => Promise<void>Function to pin a post by its ID.
deletePost(id: string) => Promise<void>Function to delete a post by its ID.
hidePost(postId: string) => Promise<void>Function to hide a post by its ID.
postComponentClickCustomCallback?ComponentDelegatorListenerOptional callback for custom component click events.

Example

For example implementation, checkout here