Skip to content

Function: useAsyncQueryExecutor()

ts
function useAsyncQueryExecutor(): AsyncQueryExecutor;

Defined in: src/wirestate-react/queries/use-async-query-executor.ts:27

Returns a stable function to dispatch async-capable queries on the active container.

Returns

AsyncQueryExecutor

An async query executor function.

Remarks

The returned executor is memoized using useCallback and stays stable for the lifetime of the container. It uses QueryBus.queryAsync internally.

Example

tsx
const queryAsync: AsyncQueryExecutor = useAsyncQueryExecutor();
const result: UserProfile = await queryAsync(GET_USER_PROFILE, { id: 123 });