Function useQueuedAction

Executes an asynchronous action with queuing and provides loading and error state.

  • Type Parameters

    • Data extends unknown = any

      The type of data returned by the action.

    • Payload extends unknown = any

      The type of payload accepted by the action.

    Parameters

    • run: ((p: Payload) => Data | Promise<Data>)

      The function that represents the action to be executed.

    • options: IParams = {}

      Optional parameters for configuring the behavior of the action execution.

    Returns IResult<Data, Payload>

    • The result object containing the loading state, error state, and the execute function to trigger the action execution.