Skip to content

Function: useQueryExecutor()

ts
function useQueryExecutor(): QueryExecutor;

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

Returns a stable function to dispatch synchronous queries on the active container.

Returns

QueryExecutor

A query executor function.

Remarks

The returned executor is memoized using useCallback and stays stable for the lifetime of the container. It uses QueryBus.query internally. Use useAsyncQueryExecutor when consumers should consistently receive a Promise.

Example

tsx
const query: QueryExecutor = useQueryExecutor();
const result: UserProfile = query(GET_USER_PROFILE, { id: 123 });