Is there a way to reset the form and set the state at the same go? I tried the below code and it does not seem to work. Any inputs are appreciated.
<Form
onSubmit={this.onSubmit}
render={({handleSubmit, form, submitting, pristine, values}) => (
<form onSubmit={handleSubmit}>
.
.
.
.
<button
type="button"
onClick={() => {
form.reset;
this.setState({"reset": true});
}}
disabled={submitting || pristine}
>
Reset
</button>
</form>
<button
type="button"
onClick={() => {
form.reset();
this.setState({"reset": true});
}}
disabled={submitting || pristine}
>
Reset
</button>
I think what you missing is executing form.reset function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With