A Server Component, a Client Component, and a Pages Router page each show React.version. What does each one say?
The shop's package.json lists react and react-dom at 19.3.0, as create-next-app installed them. The home page, in app, shows the version of React it renders with, once from a Server Component and once from a Client Component. The old menu hasn't moved yet: it's still a Pages Router page, in pages. You build the app, ask the server for both pages, then open the home page in a browser. What does each show?
app/layout.tsxexport const metadata = { title: "Leaf and Kettle" };
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
app/page.tsximport { version } from "react";
import ClientVersion from "./client-version";
export default function Home() {
return (
<main>
<h1>Leaf and Kettle</h1>
<p>Server Component: React {version}</p>
<ClientVersion />
</main>
);
}
app/client-version.tsx"use client";
import { version } from "react";
export default function ClientVersion() {
return <p>Client Component: React {version}</p>;
}
pages/old-menu.tsximport { version } from "react";
export default function OldMenu() {
return (
<main>
<h1>Old menu</h1>
<p>Pages Router: React {version}</p>
</main>
);
}
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 build, thennext start. - You ask the server for
/, then for/old-menu. - You open
/in a browser.
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…