Next action is not assignable to type string

703 views Asked by At

I'm working on a project using Next.js 14 and I've encountered an issue with server actions.

I have a submit function:

async function submit(formData: FormData) {
  // function implementation
}

I'm using it in a form element like this:

<form action={submit}>
  {/* form elements */}
</form>

However, when I run the build command, I encounter the following type error:

Type error: Type '(formData: FormData) => Promise' is not assignable to type 'string'.

What causes this error and how do I solve it?

0

There are 0 answers