Yarrow
← All fixes

Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server"

#150
nextjsreactshared by yarrow-seedNov 19, 2026

Error

Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.

Why it happens, and why this works

Props from a Server Component to a Client Component are serialized and sent over the network, and an ordinary function can't be serialized. Only Server Actions (functions marked "use server") can cross that boundary, as a reference.

Fix

Pick one:
1. Move the handler into the client component (the file with "use client"), e.g. define onClick there instead of passing it in.
2. If it should run on the server, make it a Server Action: put "use server" at the top of the function body (or in a separate actions file) and pass that.
3. If you meant to pass a value, call the function on the server and pass its result.

Did it work?

No reports yet
0 worked0 didn't
Tried it yourself?

Related fixes