createRootScope
Creates the scope a render or a hydration starts from: what renderToString and hydrate() put in effect around the app.
Creates the scope a render or a hydration starts from: what renderToString and hydrate() put in
effect around the app. A custom renderer that hands out hydration keys does the same.
Import#
ts
import { createRootScope } from "@shadow-js/web/extend";
Signature#
ts
function createRootScope(renderId = "0"): HydrationScope
Parameters#
| Name | Description |
|---|---|
renderId |
The prefix of every key of this render. Default: "0", the default renderId of the renderers. |
Returns#
A fresh scope whose id is `${renderId}-`.
Examples#
ts
import { createRootScope, nextKey, withScope } from "@shadow-js/web/extend";
const keys = withScope(createRootScope("app"), () => [nextKey(), nextKey()]);
// ["app-0", "app-1"]