useParentInstance
TheuseParentInstance hook looks up the current component’s parent item store in the Weaverse runtime.
Import
Type
Returns
WeaverseItemStore | null— The parent item store, ornullwhen 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
Fetching Data from Parent State
Use React Router’suseFetcher directly:
Implementation Details
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
Related
- useItemInstance - Access a specific component instance
- useChildInstances - Access child component instances
- useWeaverse - Access the Weaverse runtime