Skip to main content

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.

PropertyTypeDescription
topicsRecord<string, Topic>A record of topics indexed by their IDs.
widgetsRecord<string, any>A record of widgets indexed by their IDs.
selectedTopicsstring[]An array of selected topic IDs.
setSelectedTopicsReact.Dispatch<string[]>A function to update the selected topics.
loadMoreFeedsbooleanA boolean indicating whether more feeds should be loaded.
getNextPage() => Promise<void>A function to load the next page of feeds.
feedListPost[]An array of posts representing the feed list.
feedUsersListRecord<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.
postComponentClickCustomCallbackComponentDelegatorListenerAn optional custom callback for post component click events.

Example

For example implementation, checkout here