t-hooks
    Preparing search index...

    Function useGeneratorCallback

    • Generator-based asynchronous callback hook (convenience binding)

      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 (...args: A) => void

      callback to be invoked

      useGeneratorCallbackState

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