yarn react-hook-form 7.22.0
Version 7.22.0

latest releases: 7.52.0, 7.51.5, 7.51.4...
2 years ago

🖱️ improve dx with reset API within onSubmit or combined with other (#7274)

const onSubmit = (data) => {};

React.useEffect(() => {
  if (formState.isSubmitSuccessful) {
    reset({ something: '' });
  }
}, [formState, reset]);

handleSubmit(onSubmit);

to

const onSubmit = (data) => {
  setSubmittedData(data);
  reset(data); // no longer need to have useEffect
};

handleSubmit(onSubmit);

🐞 fix #7268 async reset API with useFieldArray (#7269)
🏛️ build(esm): Use explicit .mjs extension for ESM, with CJS interop (#7262)

huge thanks goes to @evocateur

Don't miss a new react-hook-form release

NewReleases is sending notifications on new releases.