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...
}

Stay tuned

Join 1,000+ subscribers and receive monthly tips & updates on new Ariakit content.

No spam. Unsubscribe anytime. Read latest issue