mobx-sentinel API doc
    Preparing search index...

    Function useFormHandler

    • Add a submission handler to the form with automatic cleanup

      Type Parameters

      • T extends object

      Parameters

      • form: Form<T>

        Form instance

      • event: "willSubmit"

        Submission phase of the handler (willSubmit, submit or didSubmit)

      • handler: (abortSignal: AbortSignal) => Promise<boolean>

        Handler to add

      Returns void

      No memoization of the handler is needed as it is stored in a ref internally.

    • Add a submission handler to the form with automatic cleanup

      Type Parameters

      • T extends object

      Parameters

      • form: Form<T>

        Form instance

      • event: "submit"

        Submission phase of the handler (willSubmit, submit or didSubmit)

      • handler: (abortSignal: AbortSignal) => Promise<boolean>

        Handler to add

      Returns void

      No memoization of the handler is needed as it is stored in a ref internally.

    • Add a submission handler to the form with automatic cleanup

      Type Parameters

      • T extends object

      Parameters

      • form: Form<T>

        Form instance

      • event: "didSubmit"

        Submission phase of the handler (willSubmit, submit or didSubmit)

      • handler: (succeed: boolean) => void

        Handler to add

      Returns void

      No memoization of the handler is needed as it is stored in a ref internally.