useClient
Reads the Kit client published by the nearest ClientProvider. Throws a SolanaError with code SOLANA_ERROR__REACT__MISSING_PROVIDER if no provider is mounted in the ancestor tree.
Pass the shape of your client through the generic (typically the AppClient type you export
alongside the client) so every installed capability is typed at the call site. This is a pure
cast with no runtime capability check, so reach for useClientCapability when a missing
plugin should fail loudly at mount instead of surfacing later as undefined.
Type Parameters
| Type Parameter | Description |
|---|---|
TClient extends object | The shape the client is expected to satisfy. Pure type assertion, so this must always be supplied — the hook can't infer it from its (absent) arguments. |
Returns
Client<TClient>