Function useTaskCallback

  • Task-based asynchronous callback hook (convinience binding)

    Task equivalent to useCallback hook allowing to perform asynchronous callbacks

    Task execution is automatically interrupted in case of additional calls or unmounting. This way, only one task is running at the given time

    Type Parameters

    • A extends any[]

      callback arguments type

    • T

      resulting task resolve type

    Parameters

    • taskFunction: TaskFunction<A, T>

      task taskFunction to be invoked as callback

    • deps: DependencyList

      dependency list

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

    callback to be invoked

      • (...args): Task<T>
      • Parameters

        • Rest ...args: A

        Returns Task<T>

    See

    useTaskCallbackState

    Note

    Task is not cancelled on hook re-render, but is cancelled on the next call instead

Generated using TypeDoc