🎓 A1Learner
🔍
0 of 50 lessons completed

Next.js The Boundary: What Can Cross It

Props cross from a Server Component to a Client Component. Some values cross, and some do not.

A function that cannot cross

The server page hands a function to a client button. The page answers with an error.

import BookCard from "@/components/BookCard";

export default function BrokenFnPage() {
  return (
    <main>
      <h1>Broken function page</h1>
      <BookCard title="Dune" onPick={() => console.log("picked Dune")} />
    </main>
  );
}

A Date that crosses fine

The server page hands a Date to a client component. The page answers 200 and shows the date.

import AddedOn from "@/components/AddedOn";

export default function BrokenDatePage() {
  return (
    <main>
      <h1>Broken date page</h1>
      <AddedOn added={new Date("2026-01-15")} />
    </main>
  );
}

Example

npm run build

Key points

  • Boundary: the line between server code and client code in one page
  • Plain data crosses the line. Strings, numbers, and plain objects pass through.
  • A function cannot cross. It lives on the server, and the browser cannot call it.
  • A class instance cannot cross. It breaks the build as well as the page.
  • A Date crosses in this version. It arrives as a real date on the client.
  • A Map crosses in this version too. It arrives with its entries intact.

In this example, the build fails on the page that passes a class instance to a client component. The error names the rule: only plain objects, and a few built-ins, can cross to Client Components. A class instance is not a plain object, so it cannot cross. The function page fails the same way at request time, with the error Event handlers cannot be passed to Client Component props. Dates and Maps cross fine in this version, so the lesson is about the two that fail, not all five.

Note

An async Client Component renders fine in this version. It is not an error here.

Try it Yourself

Edit the code, then press Run.

Running is simulated · TypeScript Playground

Exercise

Which value breaks the build when passed to a Client Component?