CACHED_SITE
An app with a server component that renders the same for the same props, and one that reads a table.
export const CACHED_SITE = `// tcm: namespace shop import { table } from "#codebase/lib/server"; import { useAppLinks, useLocation } from "#codebase/shop/lib/react"; export const visits = table<{ at: number }>("visits"); export async function addVisit(): Promise<void> { await visits.insert({ at: 1 }); } export async function Greeting({ name }: { name: string }) { return <h1>Hello {name}</h1>; } export async function Visits() { return <p className="visits">{(await visits.find()).length} visits</p>; } export function Visit() { return <button onClick={() => void addVisit()}>visit</button>; } export function App() { useAppLinks(); const path = useLocation().path; return ( <main> <Greeting name={path === "/about" ? "about" : "home"} /> <Visits /> <Visit /> <a href="/">home</a> <a href="/about">about</a> </main> ); } `