formData.get() is not a function #68175
-
|
Hey guys I'm having this problem with useFormState() where whenever I submit the form, for some reason the get function is not accessible. The server action works fine without useFormState(), where the get function is accessible and it retrieves the values. I am trying the display a message that was sent from the server to client. If you could help that would be great! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
You are passing your 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',
}
} |
Beta Was this translation helpful? Give feedback.



You are passing your
RegisterServer Action to theuseFormStatehook. In that case the first argument will beprevState, and the second argument isFormData.See the docs Server-side validation and error handling section,