Core
useFormFields()

useFormFields

TODO

  • Write documentation

Basic usage

Allows to retrieve the state of each fields

const fields = useFormFields();

Usage at top level

You will need to connect the form

const form = useForm();
const fields = useFormFields({
  connect: form,
});

Get only some fields

const someFields = useFormFields({ fields: ["firstName", "lastName"] });

You can use nested.field or array[0].nested syntaxes.

Get only some state

const fieldsIsValid = useFormFields({ selector: (field) => field.isValid });
const fieldsValues = useFormFields({ selector: (field) => field.value });
const fieldsCustom = useFormFields({
  selector: (field) =>
    field.isSubmitted && field.value === "julie" ? "OK" : "KO",
});