Overview
useCollections is the primary hook for working with a user’s collection library. It automatically fetches the root collection on mount, loads sub-collections as you navigate deeper, and exposes actions for creating, updating, deleting, and saving entities.
Requires an authenticated user. The hook reads user and project context from the nearest
ReplykeProvider.Usage Example
Parameters
This hook accepts no required parameters. Pass an empty object or nothing.Returns
The collection currently being viewed. Starts as the root collection on mount.
Direct child collections of
currentCollection. Loaded automatically when currentCollection changes.true while fetching the root collection or sub-collections.Navigate into a sub-collection. Pushes to the internal navigation stack and fetches its children.
Navigate to the previous collection in the stack.
Jump directly back to the root collection.
isEntitySaved
({ entityId, collectionId }: { entityId: string; collectionId?: string }) => Promise<{ saved: boolean; inSpecificCollection?: boolean; collections: Array<{ id: string; name: string }> }>
Check whether an entity is saved in any collection. If
collectionId is provided, also returns inSpecificCollection indicating whether it is in that specific folder.Create a new sub-collection inside the current collection.
Rename a collection.
update accepts { name: string }. The root collection cannot be renamed.Delete a collection. The root collection cannot be deleted. Navigation automatically moves to the parent after deletion.
Save an entity into the current collection.
Remove an entity from the current collection.

