Skip to content
Discussion options

You must be logged in to vote

You are passing your Register Server Action to the useFormState hook. In that case the first argument will be prevState, and the second argument is FormData.

See the docs Server-side validation and error handling section,

'use server'
 
export async function createUser(prevState: any, formData: FormData) {
  // ...
  return {
    message: 'Please enter a valid email',
  }
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@fullstacknewb
Comment options

@Juneezee
Comment options

@tushgaurav
Comment options

Answer selected by fullstacknewb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants