API reference
Every export in @ic-reactor/react, with the package that owns it.
Factories
defineReactor<T>(config)@ic-reactor/reactCreates QueryClient, ClientManager, Reactor and bound hooks in one call.
createActorHooks(reactor)@ic-reactor/reactReturns useActorQuery, useActorMutation, useActorSuspenseQuery, useActorInfiniteQuery.
createAuthHooks(auth)@ic-reactor/reactReturns useAuth and useUserPrincipal.
createQuery(reactor, opts)@ic-reactor/reactReusable query object usable inside and outside React.
createMutation(reactor, opts)@ic-reactor/reactReusable mutation with invalidateQueries support.
Hooks
useActorQuery(opts)@ic-reactor/reactCached canister query. Returns the TanStack Query result with a typed data field.
useActorSuspenseQuery(opts)@ic-reactor/reactThe same query inside a Suspense boundary — no isPending branch.
useActorInfiniteQuery(opts)@ic-reactor/reactPaginated read driven by a cursor argument.
useActorMutation(opts)@ic-reactor/reactUpdate call, with invalidateQueries naming what goes stale.
useAuth()@ic-reactor/reactlogin, logout, identity and isAuthenticated over the shared AuthenticationManager.
useUserPrincipal()@ic-reactor/reactThe current principal, or the anonymous one before sign-in.
useAgentState()@ic-reactor/reactNetwork, host and in-flight state of the shared agent.
useIdentityAttributes()@ic-reactor/reactDelegation metadata for the active identity.
Managers
ClientManager@ic-reactor/coreShared agent and cache coordination.
AuthenticationManager@ic-reactor/reactInternet Identity login, logout and delegation.
Reactor<T>@ic-reactor/coreTyped canister runtime: fetchQuery, callMethod, invalidateQueries.
DisplayReactor@ic-reactor/coreReactor with UI-friendly transforms — bigint and Principal as strings.
CandidDisplayReactor@ic-reactor/candidRuntime Candid parsing for explorers and dev tools.
Reactor methods
Everything the hooks do is reachable directly on a reactor, which is what the non-React path uses.
reactor.fetchQuery(opts)@ic-reactor/coreResolve from cache when fresh, call the canister when not.
reactor.callMethod(opts)@ic-reactor/coreUpdate call, bypassing the cache.
reactor.invalidateQueries(filter)@ic-reactor/coreMark matching cache entries stale.
reactor.actor@ic-reactor/coreThe underlying @icp-sdk/core actor, for anything not covered here.
Config
The object defineReactor and createReactor take.
| Field | Type | |
|---|---|---|
name | string | Cache namespace. Must be unique per canister |
idlFactory | IDL.InterfaceFactory | From the generated declarations |
canisterId | string | Principal | Target canister |
clientManager | ClientManager | Share one across reactors to share auth |
display | boolean | Return display-transformed values |
host | string | Replica or gateway URL |
queryClient | QueryClient | Reuse the app's existing client |