[]previous and next page

claims

The claims in effect.

The claims in effect. Read at each call (never captured), so a region that is updated after its hydration pass ended builds fresh DOM. Only hydrate() replaces it, and restores it in finally. Outside a hydration pass every method is a no-op.

Import#

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

Signature#

ts
const claims: { current: Claims }

Examples#

ts
import { claims, nextKey } from "@shadow-js/web/extend";

function createCard(): Element {
  // Adopts the server's element during hydrate(); builds a new one otherwise.
  return claims.current.claimElement(nextKey()) ?? document.createElement("article");
}