Function useHandler

  • Returns a stable function identity that is no-op during initial render and after unmount.

    Type Parameters

    • A extends any[]

      Arguments of a handler.

    • R

      A return value of a handler.

    Parameters

    • fn: undefined | null | ((...args: A) => R)

      A callback that is called by the returned handler.

    Returns ((...args: A) => R | undefined)

    A stable function identity.

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

        • Rest...args: A

        Returns R | undefined