Course lesson

Implement Fauna Signin with Next.js Server Actions and useFormState React Hook

For user signin, we'll implement a proper server action by creating a actions.js file where our server actions can live. In our login page, we'll set the component to be a client component to hold some state. This way we can use the new useFormState hook from...

Duration
4 min
Access
Free
Transcript
Retained from source evidence

For user signin, we'll implement a proper server action by creating a actions.js file where our server actions can live. In our login page, we'll set the component to be a client component to hold some state. This way we can use the new useFormState hook from react-dom and pass in our login server action.

Within the action we'll call our UserLogin function from Fauna and set a cookie with the secret we get back that we can use throughout our application.