You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is a common use case, but I sometimes have multiple buttons with a form that each have a different submit action. A simple change that I think accomplishes this is optional parameters for handleSubmit
handleSubmit=async(onSubmit?: (props: {value: TFormDataformApi: FormApi<TFormData,TFormValidator>})=>any|Promise<any>onSubmitInvalid?: (props: {value: TFormDataformApi: FormApi<TFormData,TFormValidator>})=>void){onSubmit??=this.options.onSubmitonSubmitInvalid??=this.options.onSubmitInvalid// replace options handlers with local handlers
Then I could call handleSubmit with different callbacks on the different buttons.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I don't know if this is a common use case, but I sometimes have multiple buttons with a form that each have a different submit action. A simple change that I think accomplishes this is optional parameters for handleSubmit
Then I could call handleSubmit with different callbacks on the different buttons.
Beta Was this translation helpful? Give feedback.
All reactions