1

The docs on sever action have this line:

If you aren't doing Server Mutations, you can directly pass the function as a prop like any other function. Source: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions#custom-invocation-without-starttransition

My question:

Why does this depend on the mutation? Is it okay to pass server actions from server components to client components even if the action contains a mutation and calls revalidatePath? I need to do this because right now, Next-auth's getServerSession cannot be called in server actions directly imported into client components.

Another question related to this: Why am I getting this lint warning when I try to pass a server action to a client component? It works at runtime:

enter image description here

Florian Walther
  • 6,237
  • 5
  • 46
  • 104

0 Answers0