t-hooks
    Preparing search index...

    Function useGeneratorMemoState

    • Generator-based asynchronous memo hook

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

      Task execution is automatically interrupted in case of hook re-render or unmounting. This way, only one task is running at any given time

      Type Parameters

      • T

        yielded underlying type

      • TT extends Task<T>

        yielded task type

      • R

        resulting task resolve type

      Parameters

      • initialValue: R

        initial value of type R, available immediately

      • taskGeneratorFunction: TaskGeneratorFunction<[], T, TT, R>

        task generator function

      • deps: DependencyList

        dependency list

      Returns readonly [R, boolean, () => void]

      memoized value, current execution status, and cancellation function, as [state, running, cancel]

      useTaskMemoState