Ariakit
/

useCollectionContext

Returns the collection store from the nearest collection container.

Code examples

function CollectionItem() {
const store = useCollectionContext();
if (!store) {
throw new Error("CollectionItem must be wrapped in CollectionProvider");
}
// Use the store...
}

Follow updates

Join 1,000+ subscribers and receive monthly updates with the latest improvements on API Reference.

Read latest issue

No Spam. Unsubscribe at any time.