There’s a new example on how to use forms (and other things) with Next.js App Router - see live demo which also explains the solution. The source for the form is here.
The idea is:
- The form definition is in a static file - this is only used for Netlify detecting the forms on deploy
- The form itself has an
onSubmit
handler in code rather than anaction
- the handler makes afetch
request to submit the form.