React Executor - v0.0.24
    Preparing search index...

    Function useExecutorSuspense

    • Suspends rendering until an executor satisfies a predicate.

      Type Parameters

      • Value

        The value stored by the executor.

      Parameters

      • executor: Executor<Value>

        The executors to get value of.

      • predicate: (executor: Executor) => boolean = isNotFulfilled

        The predicate which a pending executor must conform to suspend the rendering process. By default, only non-fulfilled executors are awaited.

      Returns Executor<Value>

      The executor value.

      // Suspend if executor is pending or get the current value
      const value = useExecutorSuspense(useExecutor('test', heavyTask)).get();
      const cheeseExecutor = useExecutor('cheese', buyCheeseTask);
      const beadExecutor = useExecutor('bread', bakeBreadTask);

      // Executors run in parallel and rendering is suspended until both of them are settled
      useExecutorSuspense(cheeseExecutor);
      useExecutorSuspense(breadExecutor);