Skip to content

react-hook-form 7.22.0

[7.22.0] - 2021-12-14

Changed

  • Browser native reset API will no longer be invoked when reset provided with value
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);