Logo
  1. Docs
  2. API References

useWeaverse

Published on Oct 10, 2023, updated 6 months ago

The useWeaverse hook allows components to access the Weaverse instance specific to each page, enabling the retrieval of page data, component instances, and configuration settings within a Weaverse Hydrogen theme.

Usage

Import the hook from @weaverse/hydrogen package then call it within a React Component

import { useWeaverse } from '@weaverse/hydrogen'
function MyComponent() {  let { data, itemInstances, elementRegistry } = useWeaverse()
  // Example: Accessing specific component instance data  let instance = itemInstances['uniqueComponentId']  // ...
  return (    // ...  )}
Was this article helpful?