Features:
🎯 auto focus with useFieldArray (#1689)
append({}, autoFocus = true);
prepend({}, autoFocus = true);
insert({}, autoFocus = true);
🔋 #1580 Controller with render props API (#1711)
- Controller
Less of a breaking change for existing users, simple usage remain while still give the user the full control with render prop. Remove the following props
onChange
onChangeName
onBlur
onBlurName
valueName
Simple usage as below, will not be impacted:
<Controller as={TextField} control={control} name="test" />
Usage involed configration and those remmoved props:
-<Controller
- as={CustomInput}
- valueName="textValue"
- onChangeName="onTextChange"
- control={control}
- name="test"
-/>
+<Controller
+ render={({ onChange, onBlur, value }) => (
+ <CustomInput onTextChange={onChange} onBlur={onBlur} textValue={value} />
+ )}
+ control={control}
+ name="test"
+/>
- ErrorMessage
change render props from children
to render
. you can either use as
or render
. for multiple error messages, you will have to use render
<ErrrorMessage errors={errors} as="p" />
<ErrrorMessage errors={errors} render={({message}) => {message}} />
Bug & Improvements:
🐞 fix watch and setValue type (#1705)
🐞 fix handleSubmit type for native multiple input (#1698)
🎯 close #1683 watch API with React Fast Refresh (#1685)
🐞 fix isValid issue with setError (#1678)
🎯 close #1619 issue around errors with useFieldArray (#1673)
🥂 clean up lib types' structure (#1670)
🐞 close #1619 when useFieldArray errors is not array (#1671)
🐞 fix dirty fields read at field array (#1668)
🐞 fix issue with isDirty when use context (#1666)
❤️ improve setValue and watch type (#1660)
🐞 fix register type to accept null argument (#1663)
🥂 improve generics naming (#1653)
🐞 fix dirtyFields type typo (#1654)
🎳 rename OnSubmit to SubmitHandler (#1708)
🐞 fix undefined ref in options (#1727)
✅ add displayName for easier dev-tools debugging (#1740)