Skip to content

API reference > @kontsedal/olas-vue > useQuery

useQuery() function ​

Subscribe a component to a query subscription a controller made. Each field is a ref, so a template reads it unwrapped when destructured:

ts
const { data, isLoading } = useQuery(api.user)

Signature:

typescript
export declare function useQuery<T>(subscription: AsyncState<T>): UseQueryReturn<T>;

Parameters ​

Parameter

Type

Description

subscription

AsyncState<T>

Returns:

UseQueryReturn<T>

Released under the MIT License.