---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk-vue/functions/useEnginexQuery.md
---
[Reference](../../../index.md) / [@getenginex/sdk-vue](../index.md) / useEnginexQuery

# useEnginexQuery()

> **useEnginexQuery**<`T`, `TSelect`>(`getter`, `overrides?`): `UseQueryReturnType`<`TSelect`, [`EnginexError`](../../sdk/classes/EnginexError.md)>

TanStack `useQuery` over the options of an SDK factory, with the error typed as
`EnginexError`. It takes a **getter** (not the options): it runs again when the session or any
ref read inside it changes, and the key follows. The `overrides` (`refetchInterval`, `select`,
`enabled`, `staleTime`, `retry`...) win over the factory options, except `queryKey` and `queryFn`.

* **Cancellation:** unmounting the last component observing the query aborts the SDK `fetch`.
* **Retry:** an `UNAUTHENTICATED` is not repeated, since it made no request; other errors follow the
  app's `QueryClient` `retry`. `overrides.retry` wins over both.
* **`retry` as a getter is not supported:** pass a value (number, boolean, function) or a ref.

## Type Parameters

### T

`T`

### TSelect

`TSelect` = `T`

## Parameters

### getter

() => [`EnginexQueryOptions`](../../sdk/query/interfaces/EnginexQueryOptions.md)<`T`>

Returns the options of a factory (`() => q.wallet.getBalance()`).

### overrides?

[`EnginexQueryOverrides`](../type-aliases/EnginexQueryOverrides.md)<`T`, `TSelect`>

`useQuery` options that override the factory's.

## Returns

`UseQueryReturnType`<`TSelect`, [`EnginexError`](../../sdk/classes/EnginexError.md)>

The `useQuery` result, with `error` typed as `EnginexError`.

## Throws

If called in an app without the `EnginexPlugin`.

## Example

```ts
const q = useEnginexQueries()
const page = ref(1)
const { data, error } = useEnginexQuery(() => q.wallet.listTransactions({ page: page.value }))
```
