[]previous and next page

RouterFeature

An optional capability of a router (scroll restoration, loader caching, head management, ...).

An optional capability of a router (scroll restoration, loader caching, head management, ...). The factories are exported from their own subpaths, so a router pays only for the ones it is given.

Import#

ts
import type { RouterFeature } from "@shadow-js/router";

Signature#

ts
interface RouterFeature {
  /** The feature's name. A router takes each one at most once. */
  readonly id: RouterFeatureId;
  /** @internal Installs the capability into the router being built. */
  readonly install: (host: FeatureHost) => void;
}

Members#

Name Type Description
id readonly id: RouterFeatureId The feature's name. A router takes each one at most once.
install readonly install: (host: FeatureHost) => void

Examples#

ts
import { scrollRestoration } from "@shadow-js/router/scroll";
const router = createRouter({ routes, features: [scrollRestoration()] });