Pages

tcmts.react.Pages · #m3sx64qb · term · runs in the browser

uses tcmts.react.router, which uses tcmts.react.createRouter, which uses IntersectionObserver

The page the path matches (the first of routes, by match; notFound if none). The last keep pages left (3) stay mounted but hidden (React's <Activity>), so going back shows one at once; the page a link to is pointed at is rendered ahead, hidden. The server's first paint is the page shown, alone.

import { router } from "#codebase/tcmts/react";
import type { PageProps } from "#codebase/tcmts/react";
import type { ReactNode } from "react";

export const Pages = (props: {
  routes: Record<string, (props: PageProps) => ReactNode | Promise<ReactNode>>;
  keep?: number;
  notFound?: (props: PageProps) => ReactNode | Promise<ReactNode>;
}): ReactNode => router.Pages(props) as ReactNode

uses