Next.js “Event Handlers Cannot Be Passed to Client Component Props”: Fixes That Hold Up
You add an onClick, save, and the page throws. The same server and client boundary mistake hides behind several Next.js errors, and Mongoose documents trigger the worst one. Here is how I fix each case, and why I avoid the usual shortcuts.

You add an onClick to a button, save the file, and the page throws before it paints: “Event handlers cannot be passed to Client Component props.” The file worked ten minutes ago. The button is four lines of JSX. Nothing looks wrong.
The syntax is fine. The code is running somewhere it can’t work, and the same mistake shows up under several different error messages depending on what you tried to pass. If you use Mongoose (most MERN developers moving to Next.js do), you’ll meet the worst version within a day of fetching your first document.
What actually crosses the boundary
Every component in the app directory is a Server Component unless its file has “use client” at the top or is imported by a file that does. A Server Component runs on the server, and its output goes to the browser as a serialized stream. When it renders a Client Component, the props travel in that stream.
So props have to be data. Strings, numbers, booleans, arrays, plain objects, and a few extras like Date. A function is not data. A class instance with methods is not data. That’s the whole rule, and every variation of this error is the same rule failing on a different value.
A handler on a plain element
// app/products/page.js (Server Component)
export default async function Page() {
const products = await getProducts();
return products.map((p) => (
<button key={p.id} onClick={() => addToCart(p.id)}>
Add to cart
</button>
));
}
The onClick has nowhere to run. The server has no DOM. The fix is a small client component that owns the handler.
// components/AddToCartButton.js
"use client";
export default function AddToCartButton({ productId }) {
return <button onClick={() => addToCart(productId)}>Add to cart</button>;
}
The page then renders <AddToCartButton productId={p.id} />. You pass the id, not the function.
The tempting shortcut is putting “use client” at the top of page.js. The error goes away. I’d avoid it every time. The page now runs in the browser, so your data fetching either moves into an effect (hello, spinners and request waterfalls) or breaks, and the whole page ships as JavaScript. Keep “use client” on the smallest leaf that needs it.
A function passed as a prop
Same rule, different message: “Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with ‘use server’.” You hit this when a server page renders something like <Modal onClose={() => router.back()} /> or a table with a formatter.
Table libraries are the usual offender. Column definitions with a cell: ({ row }) => ... renderer are full of functions. Define the columns inside a “use client” file, import that file into the page, and send only the row data across.
If the function really should run on the server, mark it with “use server” and you can pass it. Be careful here. A Server Action is a public POST endpoint, whether or not your UI is the only thing calling it. Check the session and validate the input inside the action, every time, the same way you would in an Express route. Treat it like a private helper and you end up with a delete action anyone can call.
One thing that does work: children. A Server Component can be passed as children to a Client Component, so a client wrapper can hold server-rendered content without trouble. Render props, where children is a function, can’t cross.
Mongoose documents
This is the one that eats an afternoon.
// app/posts/page.js
const posts = await Post.find({ published: true });
return <PostList posts={posts} />;
The error: “Only plain objects can be passed to Client Components from Server Components.” A Mongoose document is a class instance with getters and methods like save(). Not plain.
The first instinct is .lean(), which returns ordinary JavaScript objects. Good move, but you get a new error, because _id is still an ObjectId and ObjectId has a toJSON method. The message now complains about objects with toJSON methods. And lean() only helps at the top level. If your schema has an array of subdocuments, each one carries its own ObjectId _id. Buffer and Decimal128 fields break the same way.
Every forum has the shortcut:
const data = JSON.parse(JSON.stringify(posts));
It works. I don’t use it. It copies the entire result, it silently turns Dates and ObjectIds into strings, and in TypeScript the output is any, so your types say createdAt is a Date while the runtime value is a string. That mismatch comes back later as a .getTime is not a function crash in a component nobody connects to this line.
Map to the shape the client needs, by hand:
const posts = await Post.find({ published: true }).lean();
const data = posts.map((p) => ({
id: p._id.toString(),
title: p.title,
createdAt: p.createdAt.toISOString(),
}));
The explicit map has a second payoff, and it’s the real reason I insist on it. Props you pass to a Client Component are serialized into the HTML the browser receives. Open view-source and search for a field name; you’ll find it. Pass a whole user document and the password hash and the reset token ride along inside the page.
I keep one mapper per model (a toPostDTO function, say) and call it from every page and route handler that needs that model. One place to update, and one place to review when someone asks what the browser can see.
Finding the bad prop
Read the whole error before you search for it. In development, Next prints the element with the offending prop shown inline, so the culprit is usually named in the message.
In production the message is stripped down to a digest. The real text sits in your server logs (on Vercel, the function logs for that route).
There’s also a way for this to pass locally and fail after deploy. Your dev database has posts with an empty comments array, so nothing inside it can break serialization. Production has real comments, each with an ObjectId. If a page works on seed data and dies on live data, look at nested fields first.
When you can’t tell which value is the problem, check each suspect:
const isPlain = (v) => {
const proto = Object.getPrototypeOf(v);
return proto === Object.prototype || proto === null;
};
Anything that returns false and isn’t an array or a primitive is your answer.
What to do next
Search your app directory for page.js and layout.js files that start with “use client”. Each one is either justified or a shortcut somebody took to quiet this error. In my experience it’s the second more often than people admit, and pushing the boundary down to a button or a table is almost always a smaller change than it looks.