{s}omniamarkets

@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / react / useIndexerQuery

Function: useIndexerQuery()

useIndexerQuery<T>(fn, deps): IndexerQueryState<T>

Defined in: hooks.ts:269

Run an async indexer read against the context client, re-running when deps change. Errors are captured (not thrown) so a failed indexer read renders as error, not a crash. Stale responses (a slow request that resolves after a newer one) are discarded.

const { data: markets } = useIndexerQuery((c) => c.listBinaryMarkets({ limit: 20 }), []);

Type Parameters

T

T

Parameters

fn

(client) => Promise<T>

deps

readonly unknown[]

Returns

IndexerQueryState<T>