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.
Property | Type | Description |
---|---|---|
post | Post | null | The post object or null if not available. |
users | Record<string, User> | A record of user objects indexed by user ID. |
getNextPage | () => Promise<void> | Function to fetch the next page of feed details. |
loadNextPage | boolean | Flag indicating whether the next page is being loaded. |
replies | Reply[] | Array of reply objects associated with the post. |
topics | Record<string, Topic> | A record of topic objects indexed by topic ID. |
widgets | Record<string, any> | A record of widget objects indexed by widget ID. |
addNewComment | (comment: Reply, userMap: Record<string, User>) => void | Function to add a new comment to the post. |
removeAComment | (id: string) => void | Function to remove a comment by its ID. |
updateReplyOnPostReply | (id: string) => void | Function to update a reply when a post reply is made. |
updateReply | (comment: Reply, usersMap: Record<string, User>) => void | Function 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? | ComponentDelegatorListener | Optional callback for custom component click events. |
Example
For example implementation, checkout here