Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Releases: wellyshen/react-cool-form

v0.0.149

25 Mar 10:45
cbd54e2
Compare
Choose a tag to compare

✨ 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

23 Mar 10:31
ccb3453
Compare
Choose a tag to compare

💥 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's defaultValues option not working when using with useFieldArray

v0.0.147

21 Mar 16:03
a376187
Compare
Choose a tag to compare

💥 Breaking Change

  • Feat: remove the target options from mon, getState, useFormState APIs, provide a shortcut to access the form's values. #492 4f0dbaf

🐛 Bug Fixing

  • Feat: shortcut for getting form's values #494 40e9b76

v0.0.146

20 Mar 19:04
c282df7
Compare
Choose a tag to compare

Patch Changes

v0.0.145

20 Mar 17:56
c80b516
Compare
Choose a tag to compare

Patch Changes

v0.0.144

20 Mar 17:20
6395f0b
Compare
Choose a tag to compare

💥 Breaking Change

v0.0.143

20 Mar 09:25
907d9cf
Compare
Choose a tag to compare

Patch Changes

  • 4f9ae54 Thanks @wellyshen! - Fix(useFieldArray): reset fields not working properly

  • c5a700f Thanks @wellyshen! - Fix(useForm): reserve the default value of field-array from removeField method

v0.0.142

19 Mar 15:48
Compare
Choose a tag to compare
  • Fix(useFieldArray): reset value not working properly
  • Fix(useControlled): controlled components not working with field-array

v0.0.141

19 Mar 08:35
Compare
Choose a tag to compare

v0.0.140

17 Mar 13:47
6be61bc
Compare
Choose a tag to compare

💥 Breaking Change

  • Change select method to mon (a.k.a monitor)

🐛 Bug Fixing

  • Fix wrong form values due to automatically remove a field