Function useAsyncValue

This function allows you to manage an asynchronous value by providing a run function and optional parameters.

  • Type Parameters

    • Data extends unknown = any

      The data type of the async value.

    Parameters

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

      A function that returns the async value or a promise that resolves to the async value.

    • Optionalparams: IParams = {}

      Optional parameters for customizing the behavior of the async value.

    Returns [null | Data, IResult<void, void>, ((data: Data) => void), {
        waitForResult: (() => Promise<Data>);
    }]

    • An array containing the current async value, action object for executing the async action, and a setter function to update the async value.