• Gets an existing executor or create a new executor using the ExecutorManager.

    All hook usages with the same key, return the same Executor instance.

    The component is re-rendered when an executor's state is changed. The executor is activated after mount and deactivated before unmount.

    Type Parameters

    • Value = any

      The value stored by the executor.

    Parameters

    • key: unknown

      The unique executor key.

    • initialValue: undefined

      The initial executor value that is applied when executor is created by the executor manager.

    • Optional plugins: (undefined | null | ExecutorPlugin<Value>)[]

      The array of plugins that are applied to the newly created executor.

    Returns Executor<Value>

    The executor associated with the key.

  • Gets an existing executor or create a new executor using the ExecutorManager.

    All hook usages with the same key, return the same Executor instance.

    The component is re-rendered when an executor's state is changed. The executor is activated after mount and deactivated before unmount.

    Type Parameters

    • Value = any

      The value stored by the executor.

    Parameters

    • key: unknown

      The unique executor key.

    • Optional initialValue: Value | ExecutorTask<Value> | PromiseLike<Value>

      The initial executor value that is applied when executor is created by the executor manager.

    • Optional plugins: (undefined | null | ExecutorPlugin<NoInfer<Value>>)[]

      The array of plugins that are applied to the newly created executor.

    Returns Executor<Value>

    The executor associated with the key.