Performant, flexible and extensible forms library for React Hooks
The latest stable releases, with their original sources.
Some history is missing. Missing notes may hide breaking changes.
Last checked
Checking sources…
Add shouldTouch option to trigger() ([#13671](https://github.com/react-hook-form/react-hook-form/pull/13671))
setValue already supported ; now does too. This allows you to mark field(s) as touched after manual or programmatic validation, such as validate-on-mount or multi-step form navigation, without needing a workaround:
🚀 feat: add opt-in delayError option for setValue (#13337)
setValue("firstName", "Bill", {
delayError: 500, // delay validation error updates by 500ms
shouldValidate: true
});
⚡ perf: improve getDirtyFields performance ()
⚜️ feat: FieldArray component (#13394)
<FieldArray
control={control}
name="test"
render={({ fields }) => null}
/>
🐞 fix #13538 useFieldArray min 1 item validation error changes its location in the errors object () 🐞 fix calling reset triggers subscribe with latest name instead of undefined () 🐞 fix(useController): reflect cleared parent object in controlled fields () () 🐞 fix(flatten): preserve Date values as leaf nodes () 🐛 fix(unset): guard against prototype keyword path traversal () () 🏸 improve setValue api with shrink value () 👝 close improve re-render with useFieldArray reset () 🐞 fix issue: clearErrors changes the name value from form.subscribe ()
resetField() (#13735)replace() (#13734)reset() during handleSubmit() (#13733)trigger() targets their parent (#13732)handleSubmit() (#13731)trigger() targets a field with only nested resolver errors (#13730)useWatch compute cache not being initialized with the initial output (#13728)FileList being lost during flatten/expand and omit undefined values in jsonToFormData (#13725)schemaErrorLookup reporting nested containers as exact-name errors (#13727)isValidating not being recomputed after unregister() clears validating fields (#13723)reset() (#13722)iterateFieldsByAction only breaking out of one loop level (#13718)setError() overwrites (#13716)reset() not clearing validating fields (#13714)remove() leaking deleted values onto surviving field-array items (#13713)validateField calling setCustomValidity once per key in validate-object mode (#13707)useFieldArray focus behavior for checkboxes and radio buttons in appended rows (#13705)getFieldState reading isValidating from the supplied form state (#13704)unregister() stripping kept values from the submit payload (#13703)useFormState not re-subscribing when control changes (#13702)reset() keeping dirtyFields out of sync with isDirty when keepValues is enabled (#13701)useForm not reconciling correctly when an Activity subtree is initially hidden (#13698)delayError timer fires (#13697)cloneObject throwing when checking Blob with instanceof (#13694)useFieldArray retaining stale fields after an Activity subtree reconnects (#13688)_isTracked to the remaining multi-key proxy/subscribe form-state checks (#13699)_isTracked helper for proxy/subscribe form-state checks (#13690)abortEarly parameter from iterateFieldsByAction (#13689)clearErrors (#13696)useWatch compute example variable names in JSDoc (#13700)joi from 18.2.1 to 18.2.5 (#13719)shouldTouchtrigger()setValue// Mark a single field as touched after validating it
await trigger('firstName', { shouldTouch: true });
// Mark every mounted field as touched after validating the whole form
await trigger(undefined, { shouldTouch: true });
Add OpaqueTypes registry for opaque leaf types ([#13676](https://github.com/react-hook-form/react-hook-form/pull/13676))
Recursive type helpers (Path, DeepPartial, DeepRequired, FieldErrorsImpl, etc.) previously stopped only at Primitive | BrowserNativeObject. As a result, rich third-party value types such as Dayjs and Decimal could be recursively traversed member-by-member, potentially causing TypeScript to report "Excessive complexity" diagnostics on large form types.
You can now register a type as an opaque leaf via declaration merging:
import type { Dayjs } from 'dayjs';
declare module 'react-hook-form' {
interface OpaqueTypes {
dayjs: Dayjs;
}
}
While the registry is empty, types remain identical to the existing behavior. This is purely opt-in.
useController().field.onChange()-like APIs. ([#13673](https://github.com/react-hook-form/react-hook-form/pull/13673))Controller under a null parent submitting undefined instead of a value. ([#13675](https://github.com/react-hook-form/react-hook-form/pull/13675))ERR_MODULE_NOT_FOUND when resolving react-hook-form due to a react-server declaration in Next.js builds. ([#13682](https://github.com/react-hook-form/react-hook-form/pull/13682))useWatch never reconciling when an Activity subtree is hidden on its first render. ([#13683](https://github.com/react-hook-form/react-hook-form/pull/13683))resetField not recomputing isValid for subscribe-only consumers. ([#13684](https://github.com/react-hook-form/react-hook-form/pull/13684))generateWatchOutput ignoring defaultValue for an array of names. ([#13686](https://github.com/react-hook-form/react-hook-form/pull/13686))useFormState never reconciling when an Activity subtree is hidden on its first render. ([#13687](https://github.com/react-hook-form/react-hook-form/pull/13687))Thanks to @giaBaoJS, @dfedoryshchev, @Alioth-91, @Masatoshi0227, @modosc, and @bluebill1049 for their contributions! 🎉
unregister keepDirty behavior. (#13669)setValues for fields registered under object or array values. (#13667)Controller notifications for field array item roots. (#13665)setCustomValidity with criteriaMode: 'all'. (#13655)File, Blob, and FileList handling in flatten. (#13652)formState. (#13649)Thanks to @dfedoryshchev, @zigzagdev, @official-burak, @Jaybhade, @candymask0712, and @bluebill1049 for their contributions! 🎉
appendprependinsertremoveuseWatch preferring form defaultValues over the hook's own defaultValue (#13635)setValue emitting duplicate values state notifications (#13637)getFieldState error resolution for field paths (#13632)Thanks to @zigzagdev, @bluebill1049, @anshusaurav, @saulo-silva, @EduardF1, and @candymask0712 for their contributions! 🎉
keepDirtyValuessetValue not updating FieldArray values correctly (#13623)FormState type definitions (#13620)FieldArray and FormState exports (#13619)Blob coverage for FieldErrors type tests (#13624)ErrorNamespacePath type (#13615)Thanks to @candymask0712, @EduardF1, @in-ch, @johnstrand, @wanxiankai, @nobu-da, and @bluebill1049 for their contributions! 🎉
clearErrors() (#13613)dirtyFields reference stability (#13612)useController): re-subscribe onChange/onBlur when control changes (#13603)undefined (#13287)Thanks to @candymask0712, @wanxiankai, @bluebill1049, @EduardF1, @johnstrand, and @in-ch for their contributions! 🎉
🐞 fix: expose resetDefaultValues through form context (#13598)
const { resetDefaultValues } = useFormContext();
resetDefaultValues();
🐞 fix: setValue with shouldDirty now correctly updates dirty state when the form is disabled (#13594)
🐞 fix: preserve dirtyFields boolean values for registered array fields (#13586)
🐞 fix: restore FieldArray component export (#13596)
🧪 test: migrate test suite to Playwright and improve delayError test reliability (#13589)
thanks to @candymask0712, @wanxiankai, @a-y-ibrahim, @ankit1324 & @abnud11
thanks to @DakshSinghDhami, @JSap0914, @tran-simon & @EduardF1
thanks to @JSap0914