Function useFormValues

  • Hook used to gain access to values of all form fields. Causes the component to subscribe to changes of all field values.

    Type Parameters

    • Values extends object

    • Err

    Parameters

    • _Schema: FormSchema<Values, Err>
    • Optional controller: FormController

      obtained by using useFormController hook, used to connect to form state. Injected automatically via React Context when used inside FormProvider component.

    Returns Values

    object containing values of all fields. It's shape is determined by FormSchema

    Example

    const Schema = new FormSchemaBuilder()...;

    const MyForm: React.FC = () => {
    const controller = useFormController({ Schema })
    const values = useFormValues(Schema, controller)

    ...
    }

Generated using TypeDoc