How can I prevent react-hook-form from continuing to validate after it's failed validation. Take the following example.
Imagine I needed to post the value to the backend for validation I wouldnt want it to post every time I added a new value or pasted a value in the input.
Here's my sandbox. https://codesandbox.io/s/clever-shape-r37j9y?file=/src/App.tsx:74-89
You can change default validation mode by using mode and reValidateMode. please check https://react-hook-form.com/api/useform for more details. In your codesandbox, use useformas below. tested and working fine.
...
const { handleSubmit, control } = useForm({
mode: "onSubmit",
reValidateMode: "onSubmit",
});
...
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