Usage with button on RSC #10836
-
The next JS documentation states that you can use But when using this code on RSC (no use client) onClick={async () => {
"use server";
await signIn();
}} I get:
If i do the same with a form action, this is OK I know we have import { signIn } from "next-auth/react" that works, but this require client component. ANy way to proceed ? Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
decovicdev
May 6, 2024
Replies: 1 comment 2 replies
-
@ScreamZ they said
fix 1 RCC "use server";
export const signInAction = async () => {
await signIn();
} "use client";
import { signInAction } from "actions.js"
<button onClick={signInAction}></button> fix 2 RSC<button
formAction={async () => {
"use server";
await signIn();
}}
></button>
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ScreamZ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ScreamZ they said
fix 1 RCC
fix 2 RSC
onClick
on server components