Skip to main content

useWeaverse

The useWeaverse hook returns the active Weaverse runtime. Use the WeaverseNextRuntime generic when you need the Next.js page data and runtime properties. A component that calls it is a Client Component.

Import

Type

Returns

  • T — The active Weaverse runtime. It defaults to the core Weaverse type.

Common Use Patterns

Accessing Component Instances

The itemInstances registry maps component instance IDs to their item stores:

Accessing Page Data

Specify WeaverseNextRuntime to get the Next.js page data type:

Core Properties

itemInstances

Registry mapping component instance IDs to their item stores.

data

The current page data, WeaverseNextPageData: the page ID, name, root ID, SEO and component items.

elementRegistry

Registry mapping component types to their registered component definitions. It is not a registry of DOM elements or component instance IDs.

When To Use

  • When you need to find and interact with components outside the current component tree
  • When you need access to page-level runtime data