Packages

react-hook-form

7.91.0 · 23 Oct 2026MIT42M / weekRepositoryHomepagenpmAtom feed

Your version

7.6.0

15 May 2021Where it was published

7.91.0 is the newest release of 7.x.

In short

1 changed

Release note

Changed

  • useForm will register missing inputs from defaultValues

const App = () => {
  const { register, handleSubmit } = useForm({
    defaultValues: {
      test: { firstName: 'bill', lastName: 'luo' },
    },
  });

  const onSubmit = (data) => {
    // missing registered input will be included
    console.log(data); // { test: { firstName: 'bill', lastName: 'luo' } }
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input {...register('test.firstName')} />
      <button />
    </form>
  );
};