API reference > @kontsedal/olas-react > useQuery
useQuery() function
Subscribe a component to an AsyncState<T> with Suspense. The hook throwssubscription.firstValue() until the first load settles, for the nearest<Suspense>, and throws the error of a first load that fails. On successdata is T. Refetches after the first success do not re-suspend.
Signature:
typescript
export declare function useQuery<T>(subscription: AsyncState<T>, options: {
suspense: true;
}): UseSuspenseQueryResult<T>;Parameters
Parameter | Type | Description |
|---|---|---|
subscription | AsyncState<T> | |
options |
Returns: