Packages

react-hook-form

7.91.0 · 23 Oct 2026MIT42M / weekRepositoryHomepagenpmAtom feed

Your version

7.35.0

9 Sep 2022Where it was published

7.91.0 is the newest release of 7.x.

In short

1 new1 changed

Release note

[7.35.0] - 2022-9-10

Added

  • New type FieldPathByValue field path by value generic implementation

function CustomFormComponent<
  TFieldValues extends FieldValues,
  Path extends FieldPathByValue<TFieldValues, Date>,
>({ control, name }: { control: Control<FieldValues>; name: Path }) {
  const { field } = useController({
    control,
    name,
  });
}

function App() {
  const { control } = useForm<{
    foo: Date;
    baz: string;
  }>();

  return (
    <form>
      <CustomFormComponent control={control} name="foo" /> {/* no error */}
      <CustomFormComponent control={control} name="baz" />{' '}
      {/*  throw an error since baz is string */}
    </form>
  );
}

Changed

  • Form context support children prop type

<FormProvider {...methods}>
  <div /> // ✅
  <div /> // ✅
</FormProvider>