childScope
Creates a fresh scope for an isolated part of the tree, such as a Suspense boundary's content or fallback, or a portal's content: its keys depend only on key, not on the siblings around it.
Creates a fresh scope for an isolated part of the tree, such as a Suspense boundary's content or
fallback, or a portal's content: its keys depend only on key, not on the siblings around it.
Import#
ts
import { childScope } from "@shadow-js/web/extend";
Signature#
ts
function childScope(key: string | undefined): HydrationScope | null
Parameters#
| Name | Description |
|---|---|
key |
The key of the boundary (from nextKey()); undefined means no scope. |
Returns#
A scope whose id is `${key}-`; null when key is undefined.
Examples#
ts
import { childScope, nextKey, withScope } from "@shadow-js/web/extend";
function renderIsolated<T>(build: () => T): T {
return withScope(childScope(nextKey()), build);
}