Type alias ExecutionFunction<T>

ExecutionFunction<T>: ((queryArguments?, onError?) => Promise<void>)

Execute the query with the given arguments.

This function is returned by useExecuteQuery. Optionally takes an onError callback to handle errors specifically for this query execution.

To avoid overly complex types, query arguments are allowed to be partial. However, if you pass partial query arguments when setting up the hook, you must pass complete query arguments when calling the execution function.

Type Parameters

  • T

    The type of query arguments.

Type declaration

    • (queryArguments?, onError?): Promise<void>
    • Parameters

      • Optional queryArguments: Partial<T>

        Any arguments to pass to the query. Will be merged with parameters set up when the hook was created. See UseExecuteQueryParams.queryArguments.

      • Optional onError: ((error) => void)

        A callback to run when an error occurs.

          • (error): void
          • Parameters

            • error: unknown

            Returns void

      Returns Promise<void>

Returns

A promise that resolves when the query has been executed. The results of the query can be accessed through the hook's return value.