🥂 New feature
-
control
: this will be the prop pass to RHFInput
we probably can skip this hack too: #635
<RHF control={control} name="test" />
- move
RHFInput
into the main repo and rename it toController
https://github.com/react-hook-form/react-hook-form-input
<Controller control={control} name="test" />
🔨 Breaking and improved changes
- ✨improve module exports:
(we will export all types as well)
import { useForm } from 'react-hook-form';
🚨import useForm from 'react-hook-form';
will no longer work
- ✨nested
errors
object and better typescript support
type form = {
yourDetail: {
firstName: string,
}
}
errors?.yourDetail?.firstName
🚨no more flat errors :-) better TS support
- ✨triggerValidation argument change from
Object
,Object[]
toString
,String[]
triggerValidation('firstName');
triggerValidation(['firstName', 'lastName']);
🚨triggerValidation({ name: 'test', value: 'test' });
no longer work
- ✨watch support
{ nest: boolean }
watch(); // { 'test.firstName': 'bill' }
watch({ nest: true }); // { test: { firstName: 'bill' } }
- ✨improve custom
register
register('test', { required: true });
🚨register({ name: 'test'})
=> register('test')
- ✨
setError
support nested object
setError('yourDetail.firstName', 'test');
errors.yourDetails.firstName;
🚨setError('yourDetail.firstName')
no longer output flat errors object
handleSubmit
no longer rerun array inputs contains undefined
or null
✂️ API 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/api/#Browserbuiltinvalidation
Thanks to @JeromeDeLeon @kotarella1110 @umidbekkarimov @bopfer