Overview
useSpaceListActions provides the low-level fetch, create, and delete operations used internally by useSpaceList. In most cases you should use useSpaceList directly, which wraps these actions with Redux state management.
Use this hook only when you need direct control over fetching without the Redux list state layer.
Usage Example
import { useSpaceListActions } from "@replyke/react-js";
function CustomSpaceLoader({ listId }: { listId: string }) {
const actions = useSpaceListActions();
const loadSpaces = async () => {
await actions.fetchSpaces(listId, {
page: 1,
sortBy: "newest",
limit: 20,
});
};
}
Methods
fetchSpaces
(listId: string, params: FetchParams) => Promise<Space[] | null>
Fetch spaces for the given list. Updates Redux state with the results.
createSpace
(listId: string, props: CreateSpaceProps) => Promise<Space | undefined>
Create a space and insert it into the given list’s state.
deleteSpace
(listId: string, props: { spaceId: string }) => Promise<void>
Delete a space and remove it from the given list’s state.
Prefer useSpaceList for most use cases — it handles pagination state, debouncing, and load-more automatically.