Skip to main content

useChildInstances

The useChildInstances hook returns the direct child item stores of a Weaverse component.

Import

Type

Parameters

  • id?: string — The parent component ID. When omitted, the hook uses the current component ID.

Returns

  • WeaverseItemStore[] — Child item stores that are present in the runtime registry. It returns an empty array when the parent instance cannot be found.
The current SDK expects a found parent instance to contain a children array. If custom data omits that field, the hook can throw instead of returning an empty array.

Common Use Patterns

Coordinating Child Layout

Managing Interactive Children

Summarizing Child Data

Implementation Details

The hook resolves the parent with useItemInstance(), maps its child IDs to Weaverse.itemInstances, and filters out IDs that do not have a registered item store: