Function useTaskMemoState

  • Task-based asynchronous memo hook

    Task equivalent to useMemo hook allowing to perform asynchronous memorized transformations

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

    Type Parameters

    • T

      resulting task resolve type

    Parameters

    • initialValue: T

      initial value available immediately

    • taskFunction: TaskFunction<[], T>

      task taskFunction to be invoked to get transformed value

    • deps: DependencyList

      depandency list

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

    memorized value, current execution status (running or not) and cancellation function

Generated using TypeDoc