Next.js Discord

Discord Forum

How to use useFormState with react-hook-form

Unanswered
Havana posted this in #help-forum
Open in Discord
HavanaOP
While submitting the form via server action using useFormState to get the error state from the server , how use it with the react-hook-form onsubmit .

 const [state, formAction] = useFormState(addGoals, initialState);


  function onSubmit(values: z.infer<typeof formSchema>) {
    console.log(values);
\\ how to call the formaction here ?
  }

How to call the form action over their ?

0 Replies