react-hook-form 4.0.0
[4.0.0] - 2019-12-24
Breaking changes
- improve module exports:
import { useForm } from 'react-hook-form';
- nested
errorsobject and better typescript support
type form = {
yourDetail: {
firstName: string;
};
};
errors?.yourDetail?.firstName;
- triggerValidation argument change from
Object,Object[]toString,String[]
triggerValidation('firstName');
triggerValidation(['firstName', 'lastName']);
- watch support
{ nest: boolean }
watch(); // { 'test.firstName': 'bill' }
watch({ nest: true }); // { test: { firstName: 'bill' } }
- improve custom
register
register('test', { required: true });
- setError` support nested object
setError('yourDetail.firstName', 'test');
errors.yourDetails.firstName;
handleSubmitno longer rerun array inputs containsundefinedornull
Added
- move
RHFInputinto the main repo and rename it toController
<Controller control={control} name="test" />
Removed
-
validationSchemaOption: hardly anyone want to use validation with abort early, or change the config. -
native validation: hardly anyone used this feature. https://react-hook-form.com/docs/#Browserbuiltinvalidation