Function useTaskEffect

  • Task-invoking hook

    Task equivalent to useEffect hook allowing to perform asynchronous operations as effects

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

    Type Parameters

    • T

      resulting task resolve type

    Parameters

    • taskFunction: TaskFunction<[], T>

      task taskFunction to be invoked as effect

    • deps: DependencyList

      dependency list

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

    current execution status (running or not) and cancellation function

Generated using TypeDoc