A Client Component loads LastBrew with next/dynamic and ssr: false. What's in the HTML, and what does the browser show?
The Mint tea page is a Server Component. Under the brewing advice it shows LastBrew, which reads the visitor's last brewing time from localStorage while it renders, so a Client Component loads it with next/dynamic and ssr: false, with a loading message. Cache Components is on, as create-next-app sets it up. What does next build print for the page, what text is in the HTML the server sends, and what does a browser show once the page has loaded?
app/layout.tsxexport const metadata = { title: "Leaf and Kettle" };
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
app/teas/mint/page.tsximport LastBrewLoader from "./last-brew-loader";
export default function MintTeaPage() {
return (
<main>
<h1>Mint tea</h1>
<p>Steep for 3 minutes in water just off the boil.</p>
<LastBrewLoader />
</main>
);
}
app/teas/mint/last-brew-loader.tsx"use client";
import dynamic from "next/dynamic";
const LastBrew = dynamic(() => import("./last-brew"), {
ssr: false,
loading: () => <p>Checking your last brew…</p>,
});
export default function LastBrewLoader() {
return <LastBrew tea="Mint tea" />;
}
app/teas/mint/last-brew.tsx"use client";
export default function LastBrew({ tea }: { tea: string }) {
const minutes = localStorage.getItem(`last-brew:${tea}`);
return <p>{minutes ? `You last brewed ${tea} for ${minutes} minutes.` : `You haven't brewed ${tea} here yet.`}</p>;
}
It's a project create-next-app made (Next.js 16.4.3, TypeScript, the App Router, and Cache Components on) with these files, built with next build and run with next start. What happens:
- You run
next buildandnext start. - You ask the server for
/teas/mint. - You open
/teas/mintin a browser that has never visited the shop.
The answer
Work out what Next.js does at each step: what the build prints, what each request answers, and what the page shows. Then check.
Checking your sign-in…