react-hook-form

๐Ÿ“‹ React Hooks for form state management and validation (Web + React Native)

MIT License

Downloads
25.6M
Stars
39.4K
Committers
318

Bot releases are visible (Hide)

react-hook-form - Version 7.24.2

Published by bluebill1049 over 2 years ago

๐Ÿ˜ฐ close #7593 regression on fieldarray controller/useController unmount with unregister (#7596)
๐Ÿฅธ fix type issue with getFieldState and useController (#7574)

react-hook-form - Version 7.24.1

Published by bluebill1049 almost 3 years ago

๐Ÿ–จ fix #7571 cloneObject with setValue passed argument (#7572)
๐Ÿฆบ unstable _getFieldState API for retrieve field level state (#7475)
๐Ÿ’ป fix build on Windows (#7532)

thanks to @felixschorer

react-hook-form - Version 7.24.0

Published by bluebill1049 almost 3 years ago

๐Ÿง  close #6425 memorise useController prop: onChange onBlur and ref (#7526)
๐Ÿ“› related #7521 include name check with resetField (#7521)
๐Ÿช close #7518 making value update before custom onChange (#7519)
๐Ÿž fix #7256 setValue with shouldDirty and shouldTouch combine not update state correctly (#7508)

react-hook-form - Version 7.23.0

Published by bluebill1049 almost 3 years ago

Happy new year 2022!

๐Ÿ’ป Feature/avoid omitting key name use field array (improve DX) (#7301)

const App = () => {
  const { control, register, handleSubmit } = useForm<FormValues>({
    defaultValues: {
      test: [{id: 'UUID5678', test: 'data' }] // id will be remained as it match default keyName
    }
  });
  const { fields, append } = useFieldArray({
    control,
    name: 'test',
  });

  return (
    <form>
      {fields.map((field, index) => {
        return <input key={field.id} {...register(`test.${index}.test`)} />;
      })}

      <button
        type={'button'}
        onClick={() => {
          append({
            id: 'UUID1234', // id value will be remained as it match default keyName
            test: '1234',
          });
        }}
      >
        append
      </button>
    </form>
  );
};

๐Ÿ“ฒ apply useCallback for callback function to improve perf (#7378)
๐Ÿท test coverage for types (#7311)
๐ŸŽ improve useFieldArray performance with separate id state (#7447)
๐ŸŽฉ close #6776 improve register to support shadow roots (#7400)
๐Ÿ“‡ fix type infer with UseFormHandleSubmit (#7405)
๐ŸŽ remove resolutions dep and update packages (#7396)
๐ŸŽผ import type for utility
๐ŸฅŒ improve useFormState with mounted ref to skip update when hook is unmounted (#7489)
๐Ÿช” improve updateFieldArray batch update (#7477)
๐Ÿชก revert #6834 clearError should not affect isValid (#7470)

thanks to @daisuke85a, @MichalTarasiuk, @adrianos10, @barrymay and @felixschorer!

react-hook-form - Version 7.23.0-next.1

Published by bluebill1049 almost 3 years ago

๐ŸŽ improve useFieldArray performance with separate id state (#7447)
๐ŸŽฉ close #6776 improve register to support shadow roots (#7400)
๐Ÿ“‡ fix type infer with UseFormHandleSubmit (#7405)
๐ŸŽ remove resolutions dep and update packages (#7396)
๐ŸŽผ import type for utility

thanks to @MichalTarasiuk, @adrianos10 and @felixschorer

react-hook-form - Version 7.23.0-next.0

Published by bluebill1049 almost 3 years ago

๐Ÿ’ป Feature/avoid omitting key name use field array (improve DX) (#7301)

const App = () => {
  const { control, register, handleSubmit } = useForm<FormValues>({
    defaultValues: {
      test: [{id: 'UUID5678', test: 'data' }] // id will be remained as it match default keyName
    }
  });
  const { fields, append } = useFieldArray({
    control,
    name: 'test',
  });

  return (
    <form>
      {fields.map((field, index) => {
        return <input key={field.id} {...register(`test.${index}.test`)} />;
      })}

      <button
        type={'button'}
        onClick={() => {
          append({
            id: 'UUID1234', // id value will be remained as it match default keyName
            test: '1234',
          });
        }}
      >
        append
      </button>
      <button>submit</button>
    </form>
  );
};

๐Ÿ“ฒ apply useCallback for callback function to improve perf (#7378)
๐Ÿท test coverage for types (#7311)

thanks to @felixschorer

react-hook-form - Version 7.22.5

Published by bluebill1049 almost 3 years ago

Merry Christmas! ๐ŸŽ ๐Ÿ””๐ŸŽ„

๐ŸŽณ fix: change type order to make typescript hints for watch available (#7353)
๐Ÿ‚ close #7341 allow useWatch to fallback to defaultValue with undefined (#7360)
๐Ÿž fix #7347 defaultValues not populate with disabled input (#7359)

thanks to @pawk3k and @felixschorer

react-hook-form - Version 7.22.4

Published by bluebill1049 almost 3 years ago

โš”๏ธ close #7348 avoid errors state update with replace and update API (#7349)
โŒจ๏ธ include UnpackNestedValue for reset values (#7286)
โŒจ๏ธ close #7338 update FieldNamesMarkedBoolean type to boolean instead of true (#7340)

react-hook-form - Version 7.22.3

Published by bluebill1049 almost 3 years ago

๐Ÿ˜ฟ fix #7313 shouldUnregister prop with useController/controller after unmount (#7317)

react-hook-form - Version 7.22.2

Published by bluebill1049 almost 3 years ago

๐Ÿž close #7293 with async useFieldArray reset (#7299)

react-hook-form - Version 7.22.1

Published by bluebill1049 almost 3 years ago

๐Ÿž fix #7282 async reset within onSubmit formState update (#7285)

react-hook-form - Version 7.22.0

Published by bluebill1049 almost 3 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

react-hook-form - Version 7.21.3-beta.0

Published by bluebill1049 almost 3 years ago

๐Ÿ“ beta: build(esm): Use explicit .mjs extension for ESM, with CJS interop

react-hook-form - Version 7.21.2

Published by bluebill1049 almost 3 years ago

Revert "๐Ÿ—๏ธ build(esm): Use explicit .mjs extension for ESM (#7244)"

thanks to @evocateur

react-hook-form - Version 7.21.1

Published by bluebill1049 almost 3 years ago

๐Ÿช‘ remove UnionLike type (#7187)
๐ŸŒŠ useFieldArray deep nested object issue due to object reference (#7240)
๐Ÿ—๏ธ build(esm): Use explicit .mjs extension for ESM (#7244)
๐ŸŽฎ close #7231 set deep nested value with controlled input via setValue (#7232)

thanks to @evocateur

react-hook-form - Version 7.21.0

Published by bluebill1049 almost 3 years ago

๐Ÿ“ shouldUseNativeValidation will inject native validation attributes into field which supports both client & server (#7207)

const { register } = useForm()

<input {...register('name', { required: true })} />

<input name="name" required /> // both client and server render

๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ fix #2717 regression with async field array actions (#7218)

react-hook-form - Version 7.20.5

Published by bluebill1049 almost 3 years ago

๐Ÿž fix #7174 issue with empty errors object prevent submit

react-hook-form - Version 7.20.4

Published by bluebill1049 almost 3 years ago

Revert ๐Ÿ”ข fix #7149 Supporting Number Object comparison in deepEqual (#7150)

thanks to @barrymay

react-hook-form - Version 7.20.3

Published by bluebill1049 almost 3 years ago

๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง unify register onChange with useController retrieve value (#7153)
๐Ÿ‘ fix setCustomValidity typo (#7154)
๐Ÿ”ข fix #7149 Supporting Number Object comparison in deepEqual (#7150)
๐Ÿ™… prevent update input type with files (#7147)
โœ‚๏ธ deprecate unset empty array function (#7120)
๐Ÿž fix #7109 issue with field array dirty fields (#7119)

thanks to @getTobiasNielsen @swapnilrohom @lxy-yz and @LucasLemanowicz

react-hook-form - Version 7.20.2

Published by bluebill1049 almost 3 years ago

๐Ÿž fix #7090 shallow clone for object has no prototype methods (#7096)
๐Ÿ˜ฎโ€๐Ÿ’จ revert module config (#7095)
๐Ÿ“ฆ change node engine to >= 12.0

thanks to @barrymay