KEPT_PAGES
An app of a few pages, each with state of its own.
export const KEPT_PAGES = `// tcm: namespace kept import { useState } from "react"; import { Pages, useAppLinks } from "#codebase/kept/lib/react"; import type { PageProps } from "#codebase/kept/lib/react"; export function Counter({ params }: PageProps) { const [n, setN] = useState(0); return ( <section> <h1>{params.name ?? "home"}</h1> <button onClick={() => setN(n + 1)}>{n}</button> </section> ); } export function App() { useAppLinks(); return ( <main> <a href="/">home</a> <a href="/p/one">one</a> <a href="/p/two">two</a> <Pages routes={{ "/": Counter, "/p/:name": Counter }} /> </main> ); } `