Function useSinglerunAction

Function useSinglerunAction

This function is a custom hook that helps to handle asynchronous actions and manage loading and error states.

  • Type Parameters

    • Data extends unknown = any

      The type of data that the asynchronous action will return.

    • Payload extends unknown = any

      The type of payload that the asynchronous action accepts.

    Parameters

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

      The asynchronous action to be executed.

    • options: IParams = {}

      Additional options for the hook.

    Returns IResult<Data, Payload>

    • An object containing the loading state, error state, and an execute function to execute the asynchronous action.