useLMFetchFeeds
Introduction
The useLMFetchFeeds
is a custom hook that allows you to fetch and manage feed-list data from the LikeMinds API. This hook simplifies the process of making API calls and handling the resulting data, providing an easy-to-use interface for integrating feed functionality into your application.
This expects an optional parameter topicId
, upon passing, it will only fetch the feeds related to that topic.
Property | Type | Description |
---|---|---|
topics | Record<string, Topic> | A record of topics indexed by their IDs. |
widgets | Record<string, any> | A record of widgets indexed by their IDs. |
selectedTopics | string[] | An array of selected topic IDs. |
setSelectedTopics | React.Dispatch<string[]> | A function to update the selected topics. |
loadMoreFeeds | boolean | A boolean indicating whether more feeds should be loaded. |
getNextPage | () => Promise<void> | A function to load the next page of feeds. |
feedList | Post[] | An array of posts representing the feed list. |
feedUsersList | Record<string, User> | A record of users indexed by their IDs. |
deletePost | (id: string) => Promise<void> | A function to delete a post by its ID. |
pinPost | (id: string) => Promise<void> | A function to pin a post by its ID. |
likePost | (id: string) => Promise<void> | A function to like a post by its ID. |
hidePost | (postId: string) => Promise<void> | A function to hide a post by its ID. |
postComponentClickCustomCallback | ComponentDelegatorListener | An optional custom callback for post component click events. |
Example
For example implementation, checkout here