t-hooks
    Preparing search index...

    Function useGeneratorCallbackState

    • Generator-based asynchronous callback hook

      Generator version of task-callback converting generator to compound task first

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

      Type Parameters

      • A extends any[]

        callback argument types

      • T

        yielded underlying type

      • TT extends Task<T>

        yielded task type

      Parameters

      • taskGeneratorFunction: TaskGeneratorFunction<A, T, TT, void>

        task generator function; the generator returns void

      • deps: DependencyList

        dependency list

      Returns readonly [(...args: A) => void, boolean, () => void]

      callback, current execution status, and cancellation function, as [callback, running, cancel]

      useTaskCallbackState

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