Skip to main content
Returns the active Weaverse runtime from React context. itemInstances maps component instance IDs to their item stores, data is the current page data, and elementRegistry maps component types (not instance IDs or DOM nodes) to their registered definitions. In Next.js, call it from a Client Component. Toggle another component by its instance ID. setData() re-renders that component, which hides itself (for example, if (!isVisible) return null). useWeaverse() does not subscribe to items, so the toggle reads bar.data when clicked; to re-render on an item’s changes, read it with React’s useSyncExternalStore(item.subscribe, item.getSnapShot, item.getSnapShot).
Type data to read the page data, for example with WeaversePageData in a React Router theme (WeaverseNextPageData in Next.js):

Returns

T