NewYour coding agent can read the release notes before it upgrades.Set up the MCP server โ
npm, #750 most downloaded on npm
Performant, flexible and extensible forms library for React Hooks
Latest stable
7.91.0
Last release 1 months ago
23 Oct 2026
Ships on a steady schedule
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
1103 releases ยท first in 2019
Drag across the ruler to compare, or tap a release to open it.
โจ https://github.com/react-hook-form/react-hook-form/issues/7138 feature: allow selecting input's content on focus
โจ https://github.com/react-hook-form/react-hook-form/issues/7138 feature: allow selecting input's content on focus (https://github.com/react-hook-form/react-hook-form/pull/7781)
setFocus('fieldName', { shouldSelect: true })
https://user-images.githubusercontent.com/10513364/153570934-ca29337f-d7ce-4744-b282-6939c2e17b48.mp4
โจ๏ธ fix https://github.com/react-hook-form/react-hook-form/issues/7772 type issue by using UnpackNestedValue on FieldArray methods (https://github.com/react-hook-form/react-hook-form/pull/7773)
thanks to @Moshyfawn and @hpersson
setFocus to select the entire field valuesetFocus('fieldName', { shouldSelect: true });
๐ close https://github.com/react-hook-form/react-hook-form/issues/7758 useController should subscribe to exact field name
๐ close https://github.com/react-hook-form/react-hook-form/issues/7758 useController should subscribe to exact field name (https://github.com/react-hook-form/react-hook-form/pull/7759)
thanks to @Moshyfawn
Your coding agent can read these notes before it upgrades. Set up the MCP server โ
https://user-images.githubusercontent.com/10513364/152477495-7df7269c-18c2-4420-85e7-956c7c35ca42.mp4
๐ TSDoc
https://user-images.githubusercontent.com/10513364/152477495-7df7269c-18c2-4420-85e7-956c7c35ca42.mp4
๐ fix https://github.com/react-hook-form/react-hook-form/issues/7741 is validating reset when async validations are still running (https://github.com/react-hook-form/react-hook-form/pull/7747) โ close https://github.com/react-hook-form/react-hook-form/issues/7717 shallow clone errors object in handleSubmit (https://github.com/react-hook-form/react-hook-form/pull/7718) ๐ฆ close https://github.com/react-hook-form/react-hook-form/issues/7703 don't expose internal state in handleSubmit (https://github.com/react-hook-form/react-hook-form/pull/7704) ๐๏ธ save bytes on parseFloat (https://github.com/react-hook-form/react-hook-form/pull/7697)
thanks to @Moshyfawn and @tiii
๐ญ close #7686 regression on replace API and cloneObject on payload
๐ญ close #7686 regression on replace API and cloneObject on payload (#7687)
โ๏ธ close #7683 support preact with onTouched mode
โ๏ธ close #7683 support preact with onTouched mode (#7684)
thanks to @Moshyfawn
๐ fix #7662 issue with reset file input (#7656) ๐ improve perf with get proxy formState (#7655) ๐๏ธ remove redundant check (#7651) ๐ fix #7648 Unable t
๐ fix #7662 issue with reset file input (#7656)
๐ improve perf with get proxy formState (#7655)
๐๏ธ remove redundant check (#7651)
๐ fix #7648 Unable to setFocus to Controller after reset (#7649)
๐ fix: getFieldState - error might be undefined (#7636)
โ improve useFieldArray code consistency (#7628)
thanks to @Moshyfawn and @michalbundyra
โจ new getFieldState API: get individual field state
โจ new getFieldState API: get individual field state
Documentation: https://react-hook-form.com/api/useform/getfieldstate
import * as React from "react";
import { useForm } from "react-hook-form";
export default function App() {
const {
register,
getFieldState,
formState: { isDirty, isValid }
} = useForm({
mode: "onChange",
defaultValues: {
firstName: ""
}
});
// you can invoke before render or within the render function
const fieldState = getFieldState("firstName");
return (
<form>
<input {...register("firstName", { required: true })} />
<p>{getFieldState("firstName").isDirty && "dirty"}</p>
<p>{getFieldState("firstName").isTouched && "touched"}</p>
<button type="button" onClick={() => console.log(getFieldState("firstName"))}>
field state
</button>
</form>
);
}
๐ฐ close #7593 regression on fieldarray controller/useController unmount with unregister (#7596) ๐ฅธ fix type issue with getFieldState and useController
๐ฐ close #7593 regression on fieldarray controller/useController unmount with unregister (#7596)
๐ฅธ fix type issue with getFieldState and useController (#7574)
๐จ fix #7571 cloneObject with setValue passed argument (#7572) ๐ฆบ unstable _getFieldState API for retrieve field level state (#7475) ๐ป fix build on Wind
๐จ fix #7571 cloneObject with setValue passed argument (#7572)
๐ฆบ unstable _getFieldState API for retrieve field level state (#7475)
๐ป fix build on Windows (#7532)
thanks to @felixschorer
๐ง close #6425 memorise useController prop: onChange onBlur and ref (#7526) ๐ related #7521 include name check with resetField (#7521) ๐ช close #7518 ma
๐ง close #6425 memorise useController prop: onChange onBlur and ref (#7526)
๐ related #7521 include name check with resetField (#7521)
๐ช close #7518 making value update before custom onChange (#7519)
๐ fix #7256 setValue with shouldDirty and shouldTouch combine not update state correctly (#7508)
useController return prop: onChange, onBlur and ref will be memorized with useCallback๐ป Feature/avoid omitting key name use field array (improve DX) (#7301) ```tsx const App = () => { const { control, register, handleSubmit } = useForm
Happy new year 2022!
๐ป Feature/avoid omitting key name use field array (improve DX) (#7301)
const App = () => {
const { control, register, handleSubmit } = useForm<FormValues>({
defaultValues: {
test: [{id: 'UUID5678', test: 'data' }] // id will be remained as it match default keyName
}
});
const { fields, append } = useFieldArray({
control,
name: 'test',
});
return (
<form>
{fields.map((field, index) => {
return <input key={field.id} {...register(`test.${index}.test`)} />;
})}
<button
type={'button'}
onClick={() => {
append({
id: 'UUID1234', // id value will be remained as it match default keyName
test: '1234',
});
}}
>
append
</button>
</form>
);
};
๐ฒ apply useCallback for callback function to improve perf (#7378)
๐ท test coverage for types (#7311)
๐ improve useFieldArray performance with separate id state (#7447)
๐ฉ close #6776 improve register to support shadow roots (#7400)
๐ fix type infer with UseFormHandleSubmit (#7405)
๐ remove resolutions dep and update packages (#7396)
๐ผ import type for utility
๐ฅ improve useFormState with mounted ref to skip update when hook is unmounted (#7489)
๐ช improve updateFieldArray batch update (#7477)
๐ชก revert #6834 clearError should not affect isValid (#7470)
thanks to @daisuke85a, @MichalTarasiuk, @adrianos10, @barrymay and @felixschorer!
useFieldArray change keyName is no longer required when field value contains idconst App = () => {
const { control, register, handleSubmit } = useForm<FormValues>({
defaultValues: {
test: [{ id: 'UUID5678', test: 'data' }], // id value will be retained
},
});
const { fields, append } = useFieldArray({
control,
name: 'test',
});
return (
<form>
{fields.map((field, index) => {
return <input key={field.id} {...register(`test.${index}.test`)} />;
})}
<button
type={'button'}
onClick={() => {
append({
id: 'UUID1234', // id value will be retained
test: '1234',
});
}}
>
append
</button>
</form>
);
};
useFormState will no longer fire state update after hook unmountUseFormHandleSubmit type will infer formValues๐ improve useFieldArray performance with separate id state (#7447) ๐ฉ close #6776 improve register to support shadow roots (#7400) ๐ fix type infer wit
๐ improve useFieldArray performance with separate id state (#7447)
๐ฉ close #6776 improve register to support shadow roots (#7400)
๐ fix type infer with UseFormHandleSubmit (#7405)
๐ remove resolutions dep and update packages (#7396)
๐ผ import type for utility
thanks to @MichalTarasiuk, @adrianos10 and @felixschorer
๐ป Feature/avoid omitting key name use field array (improve DX)
๐ป Feature/avoid omitting key name use field array (improve DX) (#7301)
const App = () => {
const { control, register, handleSubmit } = useForm<FormValues>({
defaultValues: {
test: [{id: 'UUID5678', test: 'data' }] // id will be remained as it match default keyName
}
});
const { fields, append } = useFieldArray({
control,
name: 'test',
});
return (
<form>
{fields.map((field, index) => {
return <input key={field.id} {...register(`test.${index}.test`)} />;
})}
<button
type={'button'}
onClick={() => {
append({
id: 'UUID1234', // id value will be remained as it match default keyName
test: '1234',
});
}}
>
append
</button>
<button>submit</button>
</form>
);
};
๐ฒ apply useCallback for callback function to improve perf (#7378) ๐ท test coverage for types (#7311)
thanks to @felixschorer
๐ณ fix: change type order to make typescript hints for watch available (#7353) ๐ close #7341 allow useWatch to fallback to defaultValue with undefined
๐ณ fix: change type order to make typescript hints for watch available (#7353)
๐ close #7341 allow useWatch to fallback to defaultValue with undefined (#7360)
๐ fix #7347 defaultValues not populate with disabled input (#7359)
thanks to @pawk3k and @felixschorer
โ๏ธ close #7348 avoid errors state update with replace and update API (#7349) โจ๏ธ include UnpackNestedValue for reset values (#7286) โจ๏ธ close #7338 upda
โ๏ธ close #7348 avoid errors state update with replace and update API (#7349)
โจ๏ธ include UnpackNestedValue for reset values (#7286)
โจ๏ธ close #7338 update FieldNamesMarkedBoolean type to boolean instead of true (#7340)
๐ฟ fix #7313 shouldUnregister prop with useController/controller after unmount
๐ฟ fix #7313 shouldUnregister prop with useController/controller after unmount (#7317)
๐ close #7293 with async useFieldArray reset
๐ close #7293 with async useFieldArray reset (#7299)
๐ fix #7282 async reset within onSubmit formState update
๐ fix #7282 async reset within onSubmit formState update (#7285)
๐ฑ๏ธ improve dx with reset API within onSubmit or combined with other
๐ฑ๏ธ improve dx with reset API within onSubmit or combined with other (#7274)
const onSubmit = (data) => {};
React.useEffect(() => {
if (formState.isSubmitSuccessful) {
reset({ something: '' });
}
}, [formState, reset]);
handleSubmit(onSubmit);
to
const onSubmit = (data) => {
setSubmittedData(data);
reset(data); // no longer need to have useEffect
};
handleSubmit(onSubmit);
๐ fix #7268 async reset API with useFieldArray (#7269) ๐๏ธ build(esm): Use explicit .mjs extension for ESM, with CJS interop (#7262)
huge thanks goes to @evocateur
reset provided with valueconst onSubmit = (data) => {};
React.useEffect(() => {
if (formState.isSubmitSuccessful) {
reset({ something: '' });
}
}, [formState, reset]);
handleSubmit(onSubmit);
to
const onSubmit = (data) => {
setSubmittedData(data);
reset(data); // no longer need to have useEffect
};
handleSubmit(onSubmit);
๐ beta: build(esm): Use explicit .mjs extension for ESM, with CJS interop
๐ beta: build(esm): Use explicit .mjs extension for ESM, with CJS interop
Revert "๐๏ธ build(esm): Use explicit .mjs extension for ESM (#7244)"
Revert "๐๏ธ build(esm): Use explicit .mjs extension for ESM (#7244)"
thanks to @evocateur
๐ช remove UnionLike type (#7187) ๐ useFieldArray deep nested object issue due to object reference (#7240) ๐๏ธ build(esm): Use explicit .mjs extension fo
๐ช remove UnionLike type (#7187) ๐ useFieldArray deep nested object issue due to object reference (#7240) ๐๏ธ build(esm): Use explicit .mjs extension for ESM (#7244) ๐ฎ close #7231 set deep nested value with controlled input via setValue (#7232)
thanks to @evocateur
Nothing published for this version
๐ shouldUseNativeValidation will inject native validation attributes into field which supports both client & server
๐ shouldUseNativeValidation will inject native validation attributes into field which supports both client & server (#7207)
const { register } = useForm()
<input {...register('name', { required: true })} />
<input name="name" required /> // both client and server render
๐คฆ๐ปโโ๏ธ fix #2717 regression with async field array actions (#7218)
shouldUseNativeValidation will pass down validation props both at client and server renderconst { register } = useForm()
<input {...register('name', { required: true })} />
<input name="name" required /> // both client and server render
๐ fix #7174 issue with empty errors object prevent submit
๐ fix #7174 issue with empty errors object prevent submit
Revert ๐ข fix #7149 Supporting Number Object comparison in deepEqual
Revert ๐ข fix #7149 Supporting Number Object comparison in deepEqual (#7150)
thanks to @barrymay
โฆprevent update input type with files (#7147) โ๏ธ deprecate unset empty array function (#7120) ๐ fix #7109 issue with field array dirty fields
๐ฉโ๐ฉโ๐งโ๐ง unify register onChange with useController retrieve value (#7153)
๐ fix setCustomValidity typo (#7154)
๐ข fix #7149 Supporting Number Object comparison in deepEqual (#7150)
๐
prevent update input type with files (#7147)
โ๏ธ deprecate unset empty array function (#7120)
๐ fix #7109 issue with field array dirty fields (#7119)
thanks to @getTobiasNielsen @swapnilrohom @lxy-yz and @LucasLemanowicz
onChange will share same logic with useController for non standard event payloadconst { onChange } = register('test');
onChange('stringIsValid'); // this is only valid use case for JS
formState will no longer gets unset๐ fix #7090 shallow clone for object has no prototype methods (#7096) ๐ฎโ๐จ revert module config (#7095) ๐ฆ change node engine to >= 12.0
๐ fix #7090 shallow clone for object has no prototype methods (#7096) ๐ฎโ๐จ revert module config (#7095) ๐ฆ change node engine to >= 12.0
thanks to @barrymay
๐ฅ revert #7016 and add type test coverage (#7082) ๐ซ close #7079 flush update at the field array level before app/form-level
๐ฅ revert #7016 and add type test coverage (#7082) ๐ซ close #7079 flush update at the field array level before app/form-level (#7080)
โจ feature: useWatch/useFormState exact prop (#6983) ```tsx useWatch({ name: 'test.test', exact: true, });
โจ feature: useWatch/useFormState exact prop (#6983)
useWatch({
name: 'test.test',
exact: true,
});
useFormState({
name: 'test.test',
exact: true,
});
๐ณ close #7032 with stale onBlur value (#7078) ๐ฆ upgrade to ts 4.5.2 (#6944) ๐ remove early subscription (#7056) ๐ฆ chore: Modify package.json to include es6 imports (#7034) ๐๏ธ fix(package.json): add node requirement version (#7039)
thanks to @barrymay @neighborhood999 and @karanaditya993
exact prop for useWatchexact prop for useFormStateuseWatch({
name: 'test.test',
exact: true,
});
useFormState({
name: 'test.test',
exact: true,
});
useWatch subscription will occurred at useEffect instead before render๐ fix #7031 fast refresh
๐ fix #7031 fast refresh (#7035)
๐ close #7023 issue with async useFieldArray actions (#7029) ๐๏ธ chore(useWatch): making the name a read-only array (#7016) โจ๏ธ adds types for no suppli
๐ close #7023 issue with async useFieldArray actions (#7029) ๐๏ธ chore(useWatch): making the name a read-only array (#7016) โจ๏ธ adds types for no supplied props argument (#7017) ๐คฆ๐ปโโ๏ธ close #7013 avoid shallow clone for the custom object (#7014)
thanks to @dborysov @sfrieson
๐ fix #7011 reset API with shouldUnregister: true for controlled components
๐ fix #7011 reset API with shouldUnregister: true for controlled components (#7012)
๐ fix #7009 fix fast refresh with controller (#7010) ๐๐ป close #7001 shouldUnregister: true with useController unmount defaultValue (#7008) ๐ง close #69
๐ fix #7009 fix fast refresh with controller (#7010) ๐๐ป close #7001 shouldUnregister: true with useController unmount defaultValue (#7008) ๐ง close #6994 issue with mutate original state with shouldUnreigster: true (#6998)
๐ fix #6984 disabled input with register value (#6985) ๐คฒ close #6987 avoid shallow clone for object field
๐ fix #6984 disabled input with register value (#6985) ๐คฒ close #6987 avoid shallow clone for object field (#6988)
```tsx const { resetField } = useForm();
โจ feature: new resetField API (#6891)
const { resetField } = useForm();
resetField('test')
resetField('test', {
keepError: true,
keepDirty: true,
keepTouched: true,
defaultValue: 'test1',
})
โฑ close #6966 improve trigger by avoiding additional validation invocation (#6967)
thanks to @barrymay and @kotarella1110
resetField APIconst { resetField } = useForm();
resetField('test');
resetField('test', {
keepError: true,
keepDirty: true,
keepTouched: true,
defaultValue: 'test1',
});
useController will return shallow clone value for the following data type on each rerender
{... value}[...value]```tsx const { resetField } = useForm();
โจ new resetField API
const { resetField } = useForm();
resetField('test')
resetField('test', {
keepError: true,
keepDirty: true,
keepTouched: true,
defaultValue: 'test1',
})
๐งข close #6928 prevent schema error before user's action (#6929)
๐งนremove createSubscription and createSubscriber to reduce size (#6880)
โ๐ป improve react strict mode support with subscription
โ๐ป improve useController by integrating with useWatch
โ๐ป package size-reduction (close to 1%)
โ๐ป internally removed skipEarlySubscription
๐ fix 6933 by revert FieldPathWithValue type #6753 (#6934) ๐งข close #6928 prevent schema error before user's action
๐ fix 6933 by revert FieldPathWithValue type #6753 (#6934)
๐งข close #6928 prevent schema error before user's action (#6929)
thanks to @mnigh @kotarella1110 @barrymay
๐จโ๐จโ๐ฆ schema error parent level look up
๐จโ๐จโ๐ฆ schema error parent level look up (#6869)
const validationSchema = object().shape({
questions: array()
.min(1, "Array cannot be empty")
.of(
object().shape({
text: string().required("Some text is required")
})
)
});
function App() {
const {
control,
formState: { errors },
register
} = useForm({
mode: "onChange",
resolver: yupResolver(validationSchema),
defaultValues: { questions: [ { text: 'test' } ] }
});
const { fields, remove } = useFieldArray({
control,
name: "questions",
});
console.log(errors);
return (
<form>
{fields.map((question, questionIndex) => (
<div key={question.key}>
<input {...register(`questions[${questionIndex}].text`)} />
<button type="button"
onClick={() => {
remove(questionIndex);
}}
>
Remove
</button>
</div>
))}
</form>
);
}
Codesandbox LInk: works with min length parent error object look up
๐ fix #6896 validation isValid mixed with schema result (#6901)
๐จ close #6899 trigger isolate render for targeted input name (#6900)
๐ close #6889 disable early subscription with useController (#6890)
๐ fix #6792 reset with keepDefaultValues (#6886)
โ change the subject from class to function base to improve readability and reduce the size (#6843)
๐๐ป make sure subscriptions get unsubscribed after unmount (#6873)
๐งป prevent error lookup with fields (#6871)
Revert "Revert "โจ Add support for generic components using `FieldPatโฆ (#6753)
type ExpectedType = { test: string };
const Generic = <FormValues extends FieldValues>({
name,
control,
}: {
name: FieldPathWithValue<FormValues, ExpectedType>;
control: Control<FormValues>;
}) => {
const {
field: { value, ...fieldProps },
} = useController<FormValues, ExpectedType>({
name,
control,
defaultValue: { test: 'value' },
});
return <input type="text" value={value.test} {...fieldProps} />;
};
๐ข fix #6856 regression on set input file list (#6861) โจ๏ธ fix #6852 watch missing type with DeepPartial (#6854)
thanks to @kotarella1110
FieldPathWithValueconst validationSchema = object().shape({
questions: array().min(1, 'Array cannot be empty'),
});
// the above schema will be picked up by field array action
// the logic applies to group error object eg checkboxes
<button
type="button"
onClick={() => {
remove(questionIndex);
}}
>
Remove
</button>;
โจ Add support for generic components using FieldPathWithValue
โจ Add support for generic components using FieldPathWithValue (#6562)
type ExpectedType = { test: string };
const Generic = <FormValues extends FieldValues>({
name,
control,
}: {
name: FieldPathWithValue<FormValues, ExpectedType>;
control: Control<FormValues>;
}) => {
const {
field: { value, ...fieldProps },
} = useController<FormValues, ExpectedType>({
name,
control,
defaultValue: { test: 'value' },
});
return <input type="text" value={value.test} {...fieldProps} />;
};
โจ enable sharing form sections between forms in typescript (#6807) ๐ fix #6834 clearErrors not reset isValid formState to true โ ๏ธ close #6830 warning
โจ enable sharing form sections between forms in typescript (#6807)
๐ fix #6834 clearErrors not reset isValid formState to true
โ ๏ธ close #6830 warning under strict mode with Controller formState update (#6832)
๐งช include test coverage #6826 (#6827)
โจ add TypeScript support for optional array fields (#6826)
๐ allow Jest VSCode extension to run successfully on startup (#6810)
thanks to @barrymay @LinusU and @SimonSelg
๐ฎโ๐จ fix setFocus api issue #6804 โจ๏ธ close #6761 improve useWatch return array type (#6788) Revert "๐งถ add support for extended generics in path type (#
๐ฎโ๐จ fix setFocus api issue #6804
โจ๏ธ close #6761 improve useWatch return array type (#6788)
Revert "๐งถ add support for extended generics in path type (#6762)" (#6802)
๐ fix #6792 reset keep defaultValues with useWatch return (#6794)
โก๏ธ upgrade eslint to 8.0 and other package (#6789)
๐ฆ close #6777 fall back to defaultValues with shouldUnregister: true with unmount fieldArray (#6780) ๐งฏ change validation message in example code to ma
๐ฆ close #6777 fall back to defaultValues with shouldUnregister: true with unmount fieldArray (#6780)
๐งฏ change validation message in example code to match the rule better (#6781)
๐ณ rename document.contains to live function (#6778)
๐ fix 6764 reset with keepDefaultValues: true with isDirty and dirtyFields (#6774)
๐ fix #6765 useFieldArray trigger validation by field name (#6768)
๐งถ add support for extended generics in path type (#6762)
๐ fix #6754 focus issue with radio and checkbox (#6755)
thanks to @RolkerMan @hpohlmeyer
๐ fix #6748 skip clone object when object contains function nodes (#6749) โฎ revert interface & mapped type update (#6747) ๐ fix #6736 custom onChange
๐ fix #6748 skip clone object when object contains function nodes (#6749) โฎ revert interface & mapped type update (#6747) ๐ fix #6736 custom onChange getting called on blur (#6746) ๐ fix #6731 subscription issue with unmount field array (#6732) ๐ simplify controller field state error type (#6730) ๐ improve reset with keepDefaultValues options (#6720) ๐ improve useSubscribe hook (#6724) ๐ more TS test coverage for missing generic at useForm (#6716)
thanks to @fzkirablackwhy @kotarella1110
Revert "โจ Add support for generic components using FieldPathWithValue (#6562)" (#6717) ๐๏ธ fix Path and ArrayPath types for defined value type with int
Revert "โจ Add support for generic components using FieldPathWithValue (#6562)" (#6717)
๐๏ธ fix Path and ArrayPath types for defined value type with interface (#6626)
๐ง close #6657 support equality check on date time object (#6706)
thanks to @kotarella1110 @jviall
โจ Add support for generic components using FieldPathWithValue
โจ Add support for generic components using FieldPathWithValue (#6562)
type ExpectedType = { test: string };
const Generic = <FormValues extends FieldValues>({
name,
control,
}: {
name: FieldPathWithValue<FormValues, ExpectedType>;
control: Control<FormValues>;
}) => {
const {
field: { value, ...fieldProps },
} = useController<FormValues, ExpectedType>({
name,
control,
defaultValue: { test: 'value' },
});
return <input type="text" value={value.test} {...fieldProps} />;
};
โ๏ธ migrate from Select.options to Select.selectedOptions (#6678) (#6687) ๐ fix #6683 trigger regression with isValid subscription (#6686)
Thanks to @julienfouilhe and @krnlde
FieldPathWithValue to improve generic components type supporttype ExpectedType = { test: string };
const Generic = <FormValues extends FieldValues>({
name,
control,
}: {
name: FieldPathWithValue<FormValues, ExpectedType>;
control: Control<FormValues>;
}) => {
const {
field: { value, ...fieldProps },
} = useController<FormValues, ExpectedType>({
name,
control,
defaultValue: { test: 'value' },
});
return <input type="text" value={value.test} {...fieldProps} />;
};
โจ๏ธ fix field state error type with NestedValue (#6658) ๐ fix #6655 issue with field array focus name with filter operator (#6656) ๐ fix #6651 trigger
โจ๏ธ fix field state error type with NestedValue (#6658) ๐ fix #6655 issue with field array focus name with filter operator (#6656) ๐ fix #6651 trigger api with schema validation per field level (#6652)
Thanks to @kotarella1110 @barrymay @nicholascm @fahadsohail482
๐น fix #6646 incorrect type with fieldState error (#6650) ๐ง refactor subscription logic into useSubscribe
๐น fix #6646 incorrect type with fieldState error (#6650) ๐ง refactor subscription logic into useSubscribe (#6614)
Thanks to @kotarella1110 @barrymay
formState subscription no longer subscribed at useEffect instead the execution of each hook๐ช feat: Ability to provide custom onBlur and onChange handlers
๐ช feat: Ability to provide custom onBlur and onChange handlers (#5620)
<input
type="text"
{...register('test', {
onChange: (e) => {},
onBlur: (e) => {},
})}
/>
๐บ๏ธ fix Mapped types for defined value type with interface (#6605)
๐ฅ close #6590 prevent error throw by missing input with trigger API (#6591)
Thanks to @kotarella1110 @exneval @michalbundyra
register allowed pass custom onChange and onBlur<input
type="text"
{...register('test', {
onChange: (e) => {},
onBlur: (e) => {},
})}
/>
๐จโ๐ญ close #6581 by register input with setValue to improve DX for missing registered inputs (#6582) ๐ include unit test for #6581 setValue with missin
๐จโ๐ญ close #6581 by register input with setValue to improve DX for missing registered inputs (#6582) ๐ include unit test for #6581 setValue with missing input ๐ fix #6573 calling setValue from useEffect at mount does not update controller value (#6578) โ๏ธ close #6548 watch, reset with shouldUnregister: true by trigger extra re-render to flush out the current form values (#6549) ๐ fix async useFieldArray actions (#6540) ๐ fix typos in examples and source code (#6531) ๐ replace updateValues with cloneObject (#6530)
Thanks, @frankie303
๐ fix #6528 async reset update isMounted when isValid is not subscribed (#6529) ๐ fix #6513 reset config keepValues update formValues (#6524) ๐ fix #6
๐ fix #6528 async reset update isMounted when isValid is not subscribed (#6529)
๐ fix #6513 reset config keepValues update formValues (#6524)
๐ fix #6482 reset formValues with shouldUnregister: true (#6512)
๐ fix #6509 return defaultValues when components are not mounted (#6511)
๐จ proper fix for useController default value update (#6510)
๐ fix #2655 disabled input should set to undefined (#6501) ๐ improve ControllerFieldState type for Controller types (#6500) ๐ add File and FileList in
๐ fix #2655 disabled input should set to undefined (#6501) ๐ improve ControllerFieldState type for Controller types (#6500) ๐ add File and FileList interface for ReactNative (#6495)
Thanks, @kotarella1110
Nothing published for this version
๐ fix: add UnionLike type for FieldErrors and FieldNamesMarkedBoolean type (#6381) ๐ป ci: update from ubuntu-16.04 to ubuntu-latest (#6485) ๐ fix handl
๐ fix: add UnionLike type for FieldErrors and FieldNamesMarkedBoolean type (#6381) ๐ป ci: update from ubuntu-16.04 to ubuntu-latest (#6485) ๐ fix handleChange to set undefined value (#6481) ๐ fix #6473 isMount flag for useWatch value subscription (#6474) ๐ fix #6469 schema checkbox validation incorrect parent node lookup (#6471)
๐ [useFieldArray] new method replace()
๐ [useFieldArray] new method replace() (#6304)
const { control } = useForm({
defaultValues: {
test: [{ value: 'lorem' }, { value: 'ipsum' }]
}
});
const { fields, replace } = useFieldArray({
control,
name: 'test'
});
const handleFullyReplacement = (): void => {
// remove old and set fully new values
replace([{ value: 'dolor' }, { value: 'sit' }, { value: 'amet' }]);
}
๐ fix #6379 toggle disabled props with register api (#6459) ๐บ๏ธ improve Mapped types (#6451) ๐๏ธ refactor: improve NestedValue type (#6449) ๐๏ธ feat: improve PathValue type to fully support union type (#6431)
useFieldArray new method replace()const { control } = useForm({
defaultValues: {
test: [{ value: 'lorem' }, { value: 'ipsum' }],
},
});
const { fields, replace } = useFieldArray({
control,
name: 'test',
});
const handleFullyReplacement = (): void => {
// remove old and set fully new values
replace([{ value: 'dolor' }, { value: 'sit' }, { value: 'amet' }]);
};
interface.import { useForm } from 'react-hook-form';
interface CustomValue {
custom: string;
}
type FormValues = {
fieldName: CustomValue;
};
const { formState: errors } = useForm<FormValues>({
defaultValues: { fieldName: { custom: 'value' } },
});
๐ fix: add UnionLike type for FieldErrors type #6381
๐ fix: add UnionLike type for FieldErrors type #6381
๐ fix #6403 issue with fields object with getter and setter function (#6407) โจ๏ธ update watch observer types (#6404) ๐งฅ fix getter and setter consistenc
๐ fix #6403 issue with fields object with getter and setter function (#6407) โจ๏ธ update watch observer types (#6404) ๐งฅ fix getter and setter consistency (#6408)
๐พ improve change event perf (#6373) ๐ fix #6379 when disabled is not return from the DOM attribute (#6380) ๐งป code improvement and size reduction (#637
๐พ improve change event perf (#6373) ๐ fix #6379 when disabled is not return from the DOM attribute (#6380) ๐งป code improvement and size reduction (#6372) ๐ฎ prevent controller with TypeError: e.focus is not a function (#6386) Revert "๐น fix #6265 objects may have error messages (#6275)" (#6391)
๐ฅณ feature: add dependent validation - run a dependent field's validation after another field's validation runs
๐ฅณ feature: add dependent validation - run a dependent field's validation after another field's validation runs (#6141)
const App = () => {
const { register, getValues } = useForm();
return (
<form>
<input
{...register('firstName', {
validate: (value) => {
return getValues('lastName') === value;
}
})}
/>
<input {...register('lastName', { deps: ['firstName'] })} /> // dependant validation
</form>
);
};
๐ฆ close #6319 remove shallow clone with watch return value (#6336) ๐๏ธ fix #6320 type issue with provider context (#6326) ๐๏ธ fix #6335 useController only update field ref #6341 ๐ฎ close #6328 useController set defaultValue to be part of formValues (#6329) ๐ญ close #6367 missing absent empty object and array input from defaultValues (#6368)
register add dependent validationconst App = () => {
const { register, getValues } = useForm();
return (
<form>
<input
{...register('firstName', {
validate: (value) => {
return getValues('lastName') === value;
},
})}
/>
<input {...register('lastName', { deps: ['firstName'] })} /> // dependant
validation
</form>
);
};
๐ฅณ feature: add dependent validation - run a dependent field's validation after another field's validation runs
๐ฅณ feature: add dependent validation - run a dependent field's validation after another field's validation runs (#6141)
const App = () => {
const { register, getValues } = useForm();
return (
<form>
<input
{...register('firstName', {
validate: (value) => {
return getValues('lastName') === value;
}
})}
/>
<input {...register('lastName', { deps: ['firstName'] })} /> // dependant validation
</form>
);
};
๐ฆ close #6319 remove shallow clone with watch return value (#6336) ๐๏ธ fix #6320 type issue with provider context (#6326) ๐๏ธ fix #6335 useController only update field ref #6341 ๐ฎ close #6328 useController set defaultValue to be part of formValues (#6329)
One column per quarter.