Overview
useEntityListActions provides the low-level Redux-backed actions that power useEntityList. In most cases you should use useEntityList directly. Use this hook when you need to trigger fetch, create, or delete operations from a component that is separate from the one consuming the list state.
Usage Example
import { useEntityListActions } from "@replyke/react-js" ;
function RefreshButton () {
const { fetchEntities } = useEntityListActions ();
const handleRefresh = async () => {
await fetchEntities ( "my-feed" , {
page: 1 ,
sortBy: "hot" ,
limit: 20 ,
});
};
return < button onClick = { handleRefresh } > Refresh </ button > ;
}
Return Values
fetchEntities
(listId: string, options: FetchEntitiesOptions) => Promise<Entity[] | null>
Fetches a page of entities and dispatches the result into the Redux list state. Show FetchEntitiesOptions
sortBy
"hot" | "top" | "new" | "controversial" | "metadata.field"
required
sortByReaction
"upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny"
Used when sortBy is "top".
sortType
"auto" | "numeric" | "text" | "boolean" | "timestamp"
Type hint for metadata sorts.
Only show entities from followed users.
timeFrame
"day" | "week" | "month" | "year"
Time window filter.
include
string | ("space" | "user" | "topComment" | "saved" | "files")[]
Populate related data.
Filter by geographic proximity.
Filter by metadata fields.
createEntity
(listId: string, options: CreateEntityOptions) => Promise<Entity | undefined>
Creates an entity and inserts it into the specified list.
deleteEntity
(listId: string, options: { entityId: string }) => Promise<void>
Deletes an entity and removes it from the specified list.