Next.js Discord

Discord Forum

[Server Action] On form submit, how do I relay to client if submission was a success?

Answered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Answered by Mozzy
Just return whatever you want from the server action.

const doSomething = async (formData: FormData) => {
  const returnedValue = await submit(formData);
  console.log(returnedValue)
}
View full answer

1 Reply

Just return whatever you want from the server action.

const doSomething = async (formData: FormData) => {
  const returnedValue = await submit(formData);
  console.log(returnedValue)
}
Answer