> ## Documentation Index
> Fetch the complete documentation index at: https://weaverse.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Weaverse component configuration uses `settings`. `inspector` is deprecated; never generate it.
> Weaverse Hydrogen themes use React Router v7: import from `react-router`, never `react-router-dom` or `@remix-run/*`.
> Before using any code sample, read `@weaverse/hydrogen` in the project's `package.json`: 6.x and 5.x import from different entries and use different type names, so code for one does not build on the other.
> `@weaverse/hydrogen` 6 (Shopify Hydrogen 2026.10 and later, the version these docs show) imports from `@weaverse/hydrogen/react-router` and uses `Weaverse*` types such as `WeaverseComponentProps`, `WeaverseComponentLoaderArgs` and `WeaverseComponentSchema`; the root `@weaverse/hydrogen` entry only exports `createSchema()`, data helpers and types.
> `@weaverse/hydrogen` 5.x (Hydrogen 2026.4 and earlier) imports everything from `@weaverse/hydrogen` and uses `HydrogenComponentProps`, `ComponentLoaderArgs` and `HydrogenComponentSchema`. On a 5.x project, convert samples to these names. Upgrade to 6 only when asked (`npx @weaverse/cli@latest migrate v6`, plus the Hydrogen 2026.10 upgrade). Do not mix major versions.
> Next.js themes use `@weaverse/hydrogen` 6.2.0 or later: import client and shared code from `@weaverse/hydrogen/next` and server-only code from `@weaverse/hydrogen/next/server`. `@weaverse/next` is deprecated; never install or import it.
> For live project data (pages, theme settings, translations), use the Weaverse MCP server: https://weaverse.io/docs/developer-tools/weaverse-mcp

# useParentInstance

> Hook for accessing the parent component instance in Weaverse Hydrogen components.

# useParentInstance

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

## Import

```tsx theme={null}
import { useParentInstance } from '@weaverse/hydrogen/react-router'
```

## Type

```typescript theme={null}
function useParentInstance(): WeaverseItemStore | null
```

## Returns

* `WeaverseItemStore | null` — The parent item store, or `null` when the lookup does not find an instance.

> [!NOTE]
>
> 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

```tsx theme={null}
import { useParentInstance } from '@weaverse/hydrogen/react-router'

export function ProductItems() {
  const parent = useParentInstance()
  const products = parent?.data.loaderData?.products

  if (!products) return null

  return (
    <div className="product-grid">
      {products.nodes.map((product) => (
        <ProductCard key={product.id} product={product} />
      ))}
    </div>
  )
}
```

### Reading Parent Configuration

```tsx theme={null}
import { useParentInstance } from '@weaverse/hydrogen/react-router'

export function ReviewItem() {
  const parent = useParentInstance()

  if (!parent) return null

  const { showVerifiedBadge, verifiedBadgeText, showDate } = parent.data

  return (
    <div className="review-item">
      {/* Review content */}
      {showVerifiedBadge && (
        <span className="verified-badge">{verifiedBadgeText}</span>
      )}
      {showDate && <div className="review-date">{/* Date content */}</div>}
    </div>
  )
}
```

### Fetching Data from Parent State

Use React Router's `useFetcher` directly:

```tsx theme={null}
import { useParentInstance } from '@weaverse/hydrogen/react-router'
import { useEffect } from 'react'
import { useFetcher } from 'react-router'

export function ProductReviewList() {
  const { load, data } = useFetcher()
  const parent = useParentInstance()
  const handle = parent?.data.product?.handle

  useEffect(() => {
    if (handle) {
      load(`/api/product/${handle}/reviews`)
    }
  }, [handle, load])

  // Render the review data
}
```

The route name is project-specific. See [Integrate Judge.me Reviews with Shopify Hydrogen](https://weaverse.io/docs/hydrogen-integrations/judgeme-reviews.md) for a complete server-side example.

## Implementation Details

```tsx theme={null}
export let useParentInstance = () => {
  let { parentId } = useContext(WeaverseItemContext)
  return useItemInstance(parentId || '')
}
```

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

## Related

* [useItemInstance](https://weaverse.io/docs/api-reference/use-item-instance.md) - Access a specific component instance
* [useChildInstances](https://weaverse.io/docs/api-reference/use-child-instances.md) - Access child component instances
* [useWeaverse](https://weaverse.io/docs/api-reference/use-weaverse.md) - Access the Weaverse runtime


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.