Next.js Discord

Discord Forum

Passing an async function to "action" vs "onSubmit"

Answered
Florian posted this in #help-forum
Open in Discord
Is there any difference between passing an async function to a forms action prop vs onSubmit other than the fact that I get FormData and don't have to call e.preventDefault?
Answered by joulev
What you did is called a client action and it has a few benefits: https://x.com/reactjs/status/1716573569193476467?s=46
View full answer

2 Replies