createCorsairReactClient({ baseURL }) returns a bag of typed React hooks built on top of createCorsairClient. One factory call per app — use the returned hooks anywhere in your component tree.
corsair-client.ts
Read hooks
Read hooks follow the same shape:tenants-list.tsx
| Field | Type | Notes |
|---|---|---|
data | the typed response, or null | populated on success |
loading | boolean | true while a request is in flight |
error | Error | null | typed error if the call failed |
refetch | () => Promise<void> | manual re-trigger |
tenant-detail.tsx
useTenants, useTenant(id), usePlugins, usePlugin(id), useConnectionStatus({ tenantId }), usePermission({ id }) or usePermission({ token }).
Mutation hooks
Mutations stay idle until you callmutate(input):
create-tenant.tsx
useCreateTenant, useCreateConnectLink, useOAuthCallback.
Connection status
useConnectionStatus is the hook your dashboard probably opens with. The response is a Record<string, 'connected' | 'missing_credentials' | 'not_connected'> keyed by plugin id:
connections.tsx
Escape hatch
If a hook doesn’t fit (e.g. you need imperative access inside an event handler), reach forclient:
escape.tsx
baseURL.
What this is not
These hooks are intentionally minimal: no cache, no deduplication, no request reuse. If you want React Query, SWR, or RTK semantics, build them on top ofclient — the hooks here exist to give you typed loading/error/data state without forcing a data-layer choice.