Skip to content
Discussion options

You must be logged in to vote

In general, for multiple different submit actions you'd call handleSubmit onClick of different buttons passing different onSubmit callbacks to each of them.

const { handleSubmit } = useForm()

return (
  <section>
    <button onClick={handleSubmit(onSaveAsDraft)}>Save as Draft</button>
    <button onClick={handleSubmit(onSubmit)}>Submit</button>
  </section>
)

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@albinbrengesjo
Comment options

@TmcTrevor
Comment options

@rfdomingues98
Comment options

@thomasters17
Comment options

@sega057
Comment options

Answer selected by albinbrengesjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants