Function useHandler

  • Returns an always-stable function identity that becomes a no-op after unmount.

    Type Parameters

    • A extends any[]

      The arguments of the handler.

    • T

      The return value of the handler.

    Parameters

    • cb: ((...args) => T)

      The callback that the handler callback.

        • (...args): T
        • Parameters

          • Rest ...args: A

          Returns T

    Returns ((...args) => T)

      • (...args): T
      • Parameters

        • Rest ...args: A

        Returns T

  • Returns an always-stable function identity that becomes no-op after unmount.

    Type Parameters

    • A extends any[]

      The arguments of the handler.

    • T

      The return value of the handler.

    Parameters

    • cb: undefined | null | ((...args) => T)

      The callback that the handler callback.

    Returns ((...args) => T | undefined)

      • (...args): T | undefined
      • Parameters

        • Rest ...args: A

        Returns T | undefined