react-hook-form

📋 React Hooks for form state management and validation (Web + React Native)

MIT License

Downloads
25.6M
Stars
39.4K
Committers
318
react-hook-form - Version 3.20.3

Published by bluebill1049 about 5 years ago

  • fix a bug when watch(name) name is not in the form and leads to app crash
react-hook-form - Version 3.20.1

Published by bluebill1049 about 5 years ago

  • patch bug on async setState after submit
react-hook-form - Version 3.20.0

Published by bluebill1049 about 5 years ago

  • fix all hook methods with useCallback and making methods safe to use within useEffect
react-hook-form - Version 3.19.1

Published by bluebill1049 about 5 years ago

react-hook-form - Version 3.19.0

Published by bluebill1049 about 5 years ago

watch API update:

  1. watch return default value change:
    watch(['test', 'test1']) // deafult value return [undefined, undefined] instead of undefined
    watch() // default value return {} instead of undefined

  2. watch integrate with defaultValues
    watch will inherit from data in defaultValues, but watch function arguments remain unchanged. second argument defaultValue will overwrite data in defaultValues which set up in useForm()

  3. watch now support nested object look up
    eg

  const data = watch('test');
  console.log(data);

    <form>
      <input name="test[0]" ref={register} />
      <input name="test[1]" ref={register} />
    </form>

this above example will watch both test[0] and test[1]

defaultValues update:

defaultValues now support nested object, eg:

const { register } = useForm({
  defaultValues: { test: {data: [1, 2]}},
})

getValues update:

getValues now support nest argument to return data in a nested format, eg:

getValues(); // {'test[0]': 1, 'test[1]': 2}
getValues({ nest: true }); // {test: [1,2]}

setError update:

you can no longer clear an error with setError use clearError instead

react-hook-form - Version 3.18.14

Published by bluebill1049 about 5 years ago

  • fix a validation bug with min and max which 0 and a negative number will not be considered to be validated
react-hook-form - Version 3.18.13

Published by bluebill1049 about 5 years ago

  • fix setError during submit method
react-hook-form - Version 3.8.12

Published by bluebill1049 about 5 years ago

Fixes #136

Changes:

react-hook-form - Version 3.8.11

Published by bluebill1049 about 5 years ago

  • fix a bug on validationSchema not validating on the correct mode
react-hook-form - Version 3.18.10

Published by bluebill1049 about 5 years ago

react-hook-form - Version 3.18.9

Published by bluebill1049 over 5 years ago

react-hook-form - Version 3.18.8

Published by bluebill1049 over 5 years ago

  • revert combine values with getValues()
react-hook-form - Version 3.18.7

Published by bluebill1049 over 5 years ago

  • fix a bug with getValues() which data formate for array data is incorrect

Example below:

function App() {
  const { register, getValues } = useForm({
    defaultValues: { test: [0, 1] }
  });
  console.log(getValues()); // { test: [0, 1]}

  return (
    <form>
      <input name="test[0]" ref={register} type="checkbox" />
      <input name="test[1]" ref={register} type="checkbox" />
    </form>
  );
}
react-hook-form - Version 3.18.6

Published by bluebill1049 over 5 years ago

react-hook-form - Version 3.18.5

Published by bluebill1049 over 5 years ago

  • fix an issue with reset in useEffect #126
react-hook-form - Version 3.18.4

Published by bluebill1049 over 5 years ago

react-hook-form - Version 3.18.3

Published by bluebill1049 over 5 years ago

  • add clearError to types #122
react-hook-form - Version 3.18.2

Published by bluebill1049 over 5 years ago

  • introduced unregister method
  • patch reset when the first item in the filed list is manually registered field
react-hook-form - Version 3.18.0

Published by bluebill1049 over 5 years ago

  • support triggerValidation() with empty arugment to valdiate the whole form
react-hook-form - Version 3.17.5

Published by bluebill1049 over 5 years ago

  • Validation with schema bug with triggerValidatin