Next.js Discord

Discord Forum

Help in Server-Side Validation

Unanswered
Jerry posted this in #help-forum
Open in Discord
Avatar
JerryOP
I an currently following the [Chapter 14 - Server Side Validation](https://nextjs.org/learn/dashboard-app/improving-accessibility#server-side-validation)

I am replicating the same server action functionality i.e. createInvoice for handling the errors in the form in my blog app to createBlog action.
But when I added the useFormState in the form component, the below error is coming.

Type 'CreateFormState | undefined' is not assignable to type 'CreateFormState'.

I am not sure what I did wrong as I directly referenced the tutorial syntax.
For time being I have added the union with undefined in CreateFormState to remove the error.
Is this something, useFormState is inferencing this type?

For full code - [NextJS-Blog](https://github.com/nigupta29/nextjs-blog)
Image
Image

0 Replies