ð React Hooks for form state management and validation (Web + React Native)
MIT License
Bot releases are hidden (Show)
Published by bluebill1049 over 4 years ago
ð fix field array input dirty while onChange
ð fix issue on field array default value compare
âðŧ fix issue on clearError and remove codesandbox from npm (#878)
Published by bluebill1049 over 4 years ago
ðĨ fix useFieldArray issue with default value (#876)
Published by bluebill1049 almost 5 years ago
ð remove Controller's onBlur and use triggerValidation API instead (#862)
ð fix #833 field array dirty formState (#855)
ð
close #864 check typeof undefined inline
ð fix #864 performance api for SSR (#865)
ð fix #868 regsiter dep issue (#869)
ð remove extra variable in Controller
ð fix controller nested error (#863) @cdagli
Published by bluebill1049 almost 5 years ago
ðŧ fix issue around register during useFieldArray (#861)
ðš fix assign empty filelist (#849)
ð improve type for control (#853) @kotarella1110
Published by bluebill1049 almost 5 years ago
ðŽ fix a mistake on argument order with dirty
check on useFieldArray
Published by bluebill1049 almost 5 years ago
âĪïļ improve useFieldArray (#846) @kotarella1110
ðĶ close #833 dirty value with useFieldArray (#839)
Published by bluebill1049 almost 5 years ago
ðŠðŧ support name of dot syntax for useFieldArray (#840) @kotarella1110
ðŠðŧ allow empty object in prepend, append and insert. (#830) @tanmen
ð Allows to clean up files (#835) @hekkim
ð fix #836 revalidateMode onChange issue (#838)
ð fix issue around reset with fieldArray (#842)
Published by bluebill1049 almost 5 years ago
ð Fix/use field array with controller and reset (#831)
Published by bluebill1049 almost 5 years ago
fix #821 ssr issue (#828)
Published by bluebill1049 almost 5 years ago
ð useFieldArray (#768)
function Test() {
const { control, register } = useForm();
const { fields, append, prepend, remove, swap, move, insert } = useFieldArray(
{
control, // control props comes from useForm (optional: if you are using FormContext)
name: "test" // unique name for your Field Array
}
);
return (
<>
{fields.map((field, index) => {
return (
<div key={field.id}> {/* important: using id from to track item added or removed */}
<input name={`test[${index}}]`} ref={register} />
</div>
);
})}
</>
);
}
Name | Type | Description |
---|---|---|
fields | object & { id: string } | This object is the source of truth to map and render inputs.Important: because each inputs can be uncontrolled, id is required with mapped components to help React identify which items have changed, are added, or are removed.eg: {fields.map(d => )} |
append | (obj: any) => void | Append input/inputs to the end of your fields |
prepend | (obj: any) => void | Prepend input/inputs to the start of your fields |
insert | (index: number, value: any) => void | Insert input/inputs at particular position. |
swap | (from: number, to: number) => void | Swap input/inputs position. |
move | (from: number, to: number) => void | Move input/inputs to another position.Note: difference between move and swap, keep calling move will push input/inputs in a circle, while swap only change two input/inputs' position. |
remove | (index?: number) => void | Remove input/inputs at particular position, or remove all when no index is provided. |
Published by bluebill1049 almost 5 years ago
ð fix an issue around reset with Controller https://github.com/react-hook-form/react-hook-form/issues/810
Published by bluebill1049 almost 5 years ago
ðĻðŧâðŧ fix #801 controller register issue (#805)
ð fix typescript error type in array (#804)
Published by bluebill1049 almost 5 years ago
fix schema omit null undefined from errors
Published by bluebill1049 almost 5 years ago
âðŧ fix #793 with get method (#795)
âðŧ fix missing deep partial type (#794)
âðŧ fix #791 issue with clear field array errors
Published by bluebill1049 almost 5 years ago
ððŧ improve setValue for file type input (#790) @brennedith
ð fix contextTypes.ts with its type (#787) @bopfer
ðđ include name as dep for controller (#781)
Published by bluebill1049 almost 5 years ago
ð Fix type for rest props in Controller (#771) @JeromeDeLeon
ð close #775 controller default to undefined (#776)
Published by bluebill1049 almost 5 years ago
Removed (until we find better solution for report missing field) -> ðĶ add runtime field name check and add unit test (#756)
Published by bluebill1049 almost 5 years ago
ðĪš close #757 with null and undefined check for value (#758)
Published by bluebill1049 almost 5 years ago
ð§ support multiple errors for ErrorMessage component (#750) @kotarella1110
ðĶ add runtime field name check and add unit test (#756)
âïļ fix code review comment (#751)
ð fix #752 default value after reset (#753)
ð fix #746 focus error issue (#748)
Published by bluebill1049 almost 5 years ago
âĻ Support custom value name (#727) Thanks to @JeromeDeLeon
<Controller control={control} valueName="checked" />
ðŋ fix #728 Date type support (#744)
âïļ close #740 making control prop optional (#741)
âĻ close #730 to support min and max for custom register (#731)