This green hoodie combines comfort and style seamlessly, making it your go-to choice for a casual yet trendy look. Its soft fabric and versatile shade of green make it a wardrobe essential for all seasons.
" } }, { "productName": "Blue running shoes", "productSlug": "blue-running-shoes", "productDescription": { "html": "These blue running shoes offer both form and function, providing exceptional support and style for your active pursuits. The breathable material and cushioned sole ensure a comfortable experience mile after mile.
" } } ] } } } ```This white cotton headband provides an elegant and sophisticated touch to your hairstyle. Perfect for completing your look with a blend of fashion and comfort.
" }, "productVariant": { "productType": { "color": "White" } } } } } ```These blue running shoes offer both form and function, providing exceptional support and style for your active pursuits. The breathable material and cushioned sole ensure a comfortable experience mile after mile.
" }, "relatedProducts": { "products": [ { "productDescription": { "html": "These black leather shoes seamlessly blend sophistication with durability, making them a versatile choice for both formal occasions and everyday wear. The sleek design and high-quality leather ensure a timeless appeal that complements any outfit.
" } }, { "productDescription": { "html": "This white necklace is crafted from parts of seashells, evoking a relaxed, beachy vibe. Perfect for those looking to add a touch of the sea to their daily style.
" } }, { "productDescription": { "html": "This white cotton headband provides an elegant and sophisticated touch to your hairstyle. Perfect for completing your look with a blend of fashion and comfort.
" } }, { "productDescription": { "html": "This plaid shirt exudes a timeless charm, perfect for a casual day out or a relaxed evening gathering. The classic checkered pattern and comfortable fit make it a wardrobe staple for effortless style.
" } } ] } } } } ```This white necklace is crafted from parts of seashells, evoking a relaxed, beachy vibe. Perfect for those looking to add a touch of the sea to their daily style.
" } }, { "productName": "Headband", "productSlug": "headband", "productDescription": { "html": "This white cotton headband provides an elegant and sophisticated touch to your hairstyle. Perfect for completing your look with a blend of fashion and comfort.
" } } ] } } ```fieldApiId - The field that contains the nested component. instanceId - Unique identifier of the component instance, as returned in your GraphQL query as described below. This is not the API ID of the component. Ready: {String(isReady)} · Connected: {String(isConnected)} · Mode:{' '} {preview?.getMode() ?? 'n/a'}
); } ``` ### `usePreviewSave` Subscribes to save events. Use this instead of (or in addition to) the `onSave` prop when save handling lives in a child component. ```tsx import { usePreviewSave } from '@hygraph/preview-sdk/react'; import { useRouter } from 'next/navigation'; function SaveListener() { const router = useRouter(); usePreviewSave((entryId) => { console.log('Saved entry:', entryId); router.refresh(); }); return null; } ``` ### `usePreviewEvent` Subscribes to any [DOM event](#dom-events) the SDK dispatches on `document`. ```tsx import { usePreviewEvent } from '@hygraph/preview-sdk/react'; function FieldClickListener() { usePreviewEvent('preview:field-click', (event) => { console.log('Field clicked:', event.detail); }); return null; } ``` ### Other React hooks | Hook | Description | |---|---| | `usePreviewRefresh` | Returns a framework-aware `refresh()` helper. Falls back to `window.location.reload()` when no framework integration is detected. | | `usePreviewRemix` | Subscribes to save events and revalidates with the Remix revalidator when available. | | `usePreviewFieldUpdates` | Callbacks for `preview:field-updated` and `preview:update-failed` when `sync.fieldUpdate` is enabled. | | `usePreviewConnection` | Returns `{ isConnected, isReady, mode }`. | | `usePreviewActions` | Returns `{ refresh, destroy, getVersion, getMode }` for manual control. | | `usePreviewDebug` | Returns registry stats and framework detection for development. | ### `HygraphPreviewNextjs` Optional Next.js helper that wires `refresh` for you. Most apps use `HygraphPreview` with `next/dynamic` and `onSave={() => router.refresh()}` instead, as shown in the [App Router guide](/docs/developer-guides/schema/click-to-edit-next-js-app-router). ```tsx import { HygraphPreviewNextjs } from '@hygraph/preview-sdk/react'; import { useRouter } from 'next/navigation'; export function PreviewWrapper({ children }: { children: React.ReactNode }) { const router = useRouter(); return (