This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
Releases: wellyshen/react-cool-form
Releases · wellyshen/react-cool-form
v0.0.149
✨ New Feature
- Feat(useFormState): give you the power to listen to the changes of the properties in form state without trigger re-renders, see related doc to learn more.
import { useForm, useFormState } from "react-cool-form";
const App = () => {
const { form } = useForm({ defaultValues: { foo: "", bar: "" } });
// Triggers callback when form's values changed
useFormState("values", ({ foo, bar }) => console.log({ foo, bar }));
// Triggers callback when a field value changed
useFormState("foo", (foo) => console.log(foo));
// Triggers callback when field values changed
useFormState(["foo", "bar"], ([foo, bar]) => console.log([foo, bar]));
return <form ref={form}>{/* Some fields... */}</form>;
};
v0.0.148
💥 Breaking Change
- Feat(useFieldArray): simplify fields API, less is more!
Before
const App = () => {
const { form } = useForm({ defaultValues: { foo: [{ name: "Iron Man" }] } });
const [fields] = useFieldArray("foo");
return (
<form ref={form}>
{fields.map(([fieldName, { name }]) => (
<input key={fieldName} name={`${fieldName}.name`} defaultValue={name} />
))}
</form>
);
};
After
const App = () => {
const { form } = useForm({ defaultValues: { foo: [{ name: "Iron Man" }] } });
const [fields] = useFieldArray("foo");
return (
<form ref={form}>
{fields.map(fieldName) => (
<input key={fieldName} name={`${fieldName}.name`} />
))}
</form>
);
};
🐛 Bug Fixing
- Fix(useControlled): the
useForm
'sdefaultValues
option not working when using withuseFieldArray
v0.0.147
v0.0.146
Patch Changes
68b340a
Thanks @wellyshen! - Fix(useFieldArray): correct the type of return values
v0.0.145
Patch Changes
- #489
1eee601
Thanks @wellyshen! - Fix(useFieldArray): fields not updated by helper methods
v0.0.144
💥 Breaking Change
- Feat(useFieldArray): better API for fixing the side-effect of React Lists and Keys. See new API. Sorry this version has some problems, please use v0.0.145. (#487) (
2d70034
)
v0.0.143
Patch Changes
-
4f9ae54
Thanks @wellyshen! - Fix(useFieldArray): reset fields not working properly -
c5a700f
Thanks @wellyshen! - Fix(useForm): reserve the default value of field-array fromremoveField
method
v0.0.142
v0.0.141
- Feat: new useFieldArray hook
v0.0.140
💥 Breaking Change
- Change
select
method tomon
(a.k.a monitor)
🐛 Bug Fixing
- Fix wrong form values due to automatically remove a field