🎉 feature request: #6879 useFieldArray support rules props (#8102)
useFieldArray({
name: 'test',
rules: {
required: true,
minLength: 2,
maxLength: 10,
validate: (fieldArrayValues) => {
if (fieldArrayValues[2].title === 'test') {
return 'validate Error'
}
}
}
})
errors?.test?.root?.message // access root level errors
Note: Related context and poll for error message naming: https://github.com/react-hook-form/react-hook-form/discussions/8625
🐞 fix https://github.com/react-hook-form/react-hook-form/issues/8584: handle nullable nested properties (https://github.com/react-hook-form/react-hook-form/pull/8699) 🆎 close https://github.com/react-hook-form/react-hook-form/issues/8689 fix type inconsistency with control (https://github.com/react-hook-form/react-hook-form/pull/8691) 🐞 fix native form reset isn't executed if first fieldReference isn't a HTMLElement (https://github.com/react-hook-form/react-hook-form/pull/8678) 🐞 fix useFieldArray action type incorrectness (https://github.com/react-hook-form/react-hook-form/pull/8660) 🚔 close https://github.com/react-hook-form/react-hook-form/issues/8653 when useFormContext provide no generic for type check (https://github.com/react-hook-form/react-hook-form/pull/8654) 🛰 useFormContext include type tests (https://github.com/react-hook-form/react-hook-form/pull/8656) 🤣 fix typo in useForm.ts (https://github.com/react-hook-form/react-hook-form/pull/8645) 📚 README Helper / Sponsor Generation Script / Workflow ()