Next.js Discord

Discord Forum

Functions cannot be passed directly to Client Components

Answered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
Are the nextjs docs outdated?

I'm trying to follow their guide for https://nextjs.org/docs/app/building-your-application/authentication after taking a break from last time because the structure was confusing, now for example they use <form action={signup}> in their example, but this throws
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.
Answered by joulev
Does the file exporting login have "use server" at the top?
View full answer

8 Replies

Giant pandaOP
I dont really see me doing anything different though :/
was I supposed to include that component into another page that uses "use server" or something?
@Giant panda I dont really see me doing anything different though :/
Does the file exporting login have "use server" at the top?
Answer
Giant pandaOP
oh no it did in fact not have that
the docs didnt put that in D:
grr
alrighty well that fixed it, thamk u
Yeah normal functions cannot be used as props in server components, but server actions can be used that way