[]previous and next page

currentScope

Returns the hydration scope in effect.

Returns the hydration scope in effect.

Import#

ts
import { currentScope } from "@shadow-js/web/extend";

Signature#

ts
function currentScope(): HydrationScope | null

Returns#

The current scope; null outside a server render, a hydration, or a withScope call.

Examples#

ts
import { currentScope } from "@shadow-js/web/extend";

function scopeLabel(): string {
  return currentScope()?.id ?? "no scope";
}