Function useFormController

  • Hook that manages form state - should be used in main form component. Does not cause the component to subscribe to any form state changes.

    Type Parameters

    • Values extends object

    • Err

    Parameters

    • options: FormtsOptions<Values, Err>

      FormtsOptions used to configure form. Requires Schema created using FormSchemaBuilder.

    Returns FormController

    FormController object which connects other hooks to form state. Can be passed directly to other hooks or via FormProvider component.

    Example

    const Schema = new FormSchemaBuilder()...;

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

    ...
    }

Generated using TypeDoc