Skip to main content

useParentInstance

The useParentInstance hook looks up the current component’s parent item store in the Weaverse runtime.

Import

Type

Returns

  • WeaverseItemStore | null — The parent item store, or null when the lookup does not find an instance.
In SDK v5.19.1, a missing parent ID falls back to the current item because useParentInstance() delegates to useItemInstance(parentId || ''). Root components therefore receive their own item store rather than null.

Common Use Patterns

Accessing Parent Loader Data

Reading Parent Configuration

Implementation Details

The empty-string fallback is significant because useItemInstance() treats a falsy ID as a request for the current item.

When To Use

  • When a child component needs data or configuration from its parent
  • When implementing coordinated parent-child behavior
  • When a child’s rendering depends on parent state