๐ React Hooks for form state management and validation (Web + React Native)
MIT License
Bot releases are hidden (Show)
Published by bluebill1049 about 3 years ago
โ UX: useForm
config delayError
(#5935)
useForm({
delayError: 500 // delay error appear with 500ms
})
โจ๏ธ stricter type check on onChange event type (#6030)
๐ fix #6035 issue with Controller select toggle inValid state (#6069)
๐ fix #6055 missing dirtyFields subscribe in useFieldArray actions (#6059)
๐ fix #6052 miss marking controller as mounted (#6053)
Published by bluebill1049 over 3 years ago
๐ fix #5944 reset issue with unmounted useFieldArray (#5954)
๐ fix #5942 case when value is supplied as null/undefined
โจ๏ธ close #5928 improve useWatch and watch types (#5945)
๐ฎ fix #5936 regression with controller value transform (#5937)
Published by bluebill1049 over 3 years ago
๐
update
method for useFieldArray (#5835)
const { update } = useFieldArray();
update(0, data); // update an individual field array node
๐ fix #5911 issue with reset clear flag for Controller (#5912)
โจ๏ธ fix #5839 issue with null type with deepMap (#5896)
๐ close #5857 setValue missing await with trigger validation (#5859)
๐จ๐ปโ๐ป chore: allow readonly tuple in useWatch generic params (#5845)
Published by bluebill1049 over 3 years ago
๐๏ธ fix #5808 DeepMap extend issue with File (#5813)
๐ต๏ธ fix #5816 variable name typo in useController
Published by bluebill1049 over 3 years ago
๐ deprecated defaultValue
at useFieldArray
as a required prop (#5636)
function Test() {
const { control, register } = useForm();
const { fields, append, prepend, remove, swap, move, insert } = useFieldArray({
control,
name: "test",
});
return (
{fields.map((field, index) => (
<input
key={field.id} // important to include key with field's id
{...register(`test.${index}.value`)}
- defaultValue={field.value} // no longer required
/>
))}
);
}
๐จ๐ปโ๐ป fix #5787 controller type for defaultValue (#5792)
๐ฟ fix #5777 regression on unmount defaultValue with shouldUnregister:true (#5778)
๐
close #5724 setValue skip parse date time as object (#5729)
๐ฎ #5712 enable controller with native validation (#5716)
๐ fix spread non-primitive values in nested array fields (#5705)
๐ช batch single watch update (#5707)
๐๏ธ batch unregister inputs (#5706)
๐ fix #5699 trigger not focusing first input with error (#5700)
Published by bluebill1049 over 3 years ago
๐ฅ feature: support browser native form control (#5503)
export default function App() {
const { register, handleSubmit } = useForm({
shouldUseNativeValidation: true,
});
const onSubmit = (data) => console.log(data);
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input
{...register("firstName", {
required: "This is required from bill."
})}
autoComplete={"off"}
placeholder="First Name"
/>
<input type="submit" />
</form>
);
}
๐ fix #5661 trigger throw error when the field is not found (#5664)
๐ fix #5678 reset with keep default values with Controller (#5688)
Published by bluebill1049 over 3 years ago
register
input without defaultValue
for useFieldArray
Published by bluebill1049 over 3 years ago
defaultValue
as required prop for useFieldArray
function Test() {
const { control, register } = useForm();
const { fields } = useFieldArray({
control,
name: "test",
});
return (
{fields.map((field, index) => (
<input
key={field.id} // important to include key with field's id
{...register(`test.${index}.value`)}
- defaultValue={field.value} // make sure to include defaultValue
/>
))}
);
}
Published by bluebill1049 over 3 years ago
๐ fix #5627 defaultValue reset inconsistent with setValueAs (#5634)
Published by bluebill1049 over 3 years ago
๐ fix #5623 Controller unmount to skip validation (#5624)
Published by bluebill1049 over 3 years ago
๐ fix #5611 should not update dirty fields with blur event (#5614)
๐ fix #5612 trigger() always return true (#5613)
Published by bluebill1049 over 3 years ago
๐ผ close #5603 to enable nested field array register with useFieldArray
๐๏ธ improve useController to only return focus method from ref (#5582)
๐๏ธ improve useFieldArray when it's getting unmount and pulling the latest values (#5583)
Published by bluebill1049 over 3 years ago
๐ fix #5555 register deeply nested field append with strict mode (#5580)
๐ fix #5566 should unregister inputs when useFieldArray unmounted (#5579)
๐ข fix #5568 include . for a precise focus index lookup (#5578)
๐ต๏ธโโ๏ธ improve logic on register absent inputs (#5556)
๐ฎ fix #5538 type error with setError shouldFocus
Published by bluebill1049 over 3 years ago
๐ fix #5527 resolver switching (#5530)
Published by bluebill1049 over 3 years ago
๐ fix #5507 register with value issue (#5511)
Published by bluebill1049 over 3 years ago
๐ fix #5506 watch return null value with field array
Published by bluebill1049 over 3 years ago
๐ fix #5499 issue with controller defaultValue overwrite defaultValues at useForm (#5500)
Published by bluebill1049 over 3 years ago
๐ fix #5492 with empty reset with useController setting unmount attribute (#5493)
๐ improve logic on unmount input with ref callback (#5488)
โ๏ธ feature: support shouldTouch with setValue (#5181)
โป๏ธ useFieldArray improvement with register value API (#5473)
๐ feature: support register with value (#5380)
๐ useFieldArray reduce function (#5471)
๐ช improve focus logic for field array (#5470)
๐ชข improve register perf and remove duplicated logic (#5469)
๐งฏ close #5440 remove extra value update (#5442)
๐ฌ remove extra ref assign (#5433)
๐ช Improve isValid form State by removing extra internal formState (#5415)
Published by bluebill1049 over 3 years ago
๐ only register absent fields with shouldUnregister: false
(#5418)
Published by bluebill1049 over 3 years ago
๐ feature: focus with trigger (#4960)
trigger('firstName', { shouldFocus: true})
๐งผ bubble up the error when thrown in submit handler (#5391)