useWeaverse
The useWeaverse hook returns the active Weaverse runtime. In Hydrogen themes, pass a type argument when you need Hydrogen-specific page data, such as { data: WeaversePageData }. @weaverse/hydrogen 6 no longer exports the WeaverseHydrogen runtime class.
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
Pass WeaversePageData as the data type to get the Hydrogen page data type:
Core Properties
itemInstances
Registry mapping component instance IDs to their item stores.
data
The current project data. In a Hydrogen theme, this is WeaversePageData, which includes the page ID, name, root ID, 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
Last modified on November 10, 2026