RspcTypescript apiTs rspc react
@rspc/react
TypeScript API reference for @rspc/react, version 0.0.0-main-7c0a67c1.
0.0.0-main-7c0a67c1
0.2.20.2.10.2.00.0.0-main-b8b35d280.0.0-main-45466c860.0.0-main-9452a4610.0.0-main-842dee871.0.0-rc.30.0.0-main-2e237f7b1.0.0-rc.20.0.0-main-50d5642f1.0.0-rc.10.0.0-main-52bdb3c10.0.0-main-bca3242b0.0.0-main-f10683d00.0.0-main-ee02fc570.0.0-main-6ed8cc980.0.0-main-9c15d2d40.0.0-main-799eec5d0.0.0-main-4caedb140.0.0-main-3c0947890.0.0-main-a312a5050.0.0-main-a2d5effc0.0.0-main-5d4b97910.0.0-main-cc3386190.0.0-main-333a38d40.0.0-main-f9ac6b780.0.0-main-7cdd90da0.1.30.0.0-main-32fe3d8a0.0.0-main-7c0a67c10.1.20.1.10.1.00.0.6
Generated from the published type declarations for this exact release.
Public exports of @rspc/react at version 0.0.0-main-7c0a67c1.
This page documents 0.0.0-main-7c0a67c1. The documented version is 0.2.2.
Interfaces
BaseOptions
interface BaseOptions<TProcedures extends ProceduresDef> {
rspc?: {
client?: Client<TProcedures>;
abortOnUnmount?: boolean;
};
}
Context
interface Context<TProcedures extends ProceduresDef, TQueries extends ProcedureDef, TMutations extends ProcedureDef, TSubscriptions extends ProcedureDef> {
client: Client<TProcedures, TQueries, TMutations, TSubscriptions>;
queryClient: QueryClient;
}
SubscriptionOptions
interface SubscriptionOptions<TOutput> {
enabled?: boolean;
onStarted?: () => void;
onData: (data: TOutput) => void;
onError?: (err: RSPCError) => void;
}
Functions
createReactHooks
declare function createReactHooks<TBaseProcedures extends ProceduresDef = never, TQueries extends ProcedureDef = TBaseProcedures["queries"], TMutations extends ProcedureDef = TBaseProcedures["mutations"], TSubscriptions extends ProcedureDef = TBaseProcedures["subscriptions"]>(hookOpts?: HookOptions): {
createClient: any;
useContext: () => Context<any, any, any, any>;
Provider: ({ children, client, queryClient, }: {
children?: ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
client: {
_rspc_def: {
queries: any;
mutations: any;
subscriptions: any;
};
query: <K extends any>(keyAndInput: [
key: K
] | [
K,
any
], opts?: _rspc_client.TRPCRequestOptions | undefined) => Promise<any>;
mutation: <K_1 extends any>(keyAndInput: [
key: K_1
] | [
// … truncated, see the source link
internal_createReactHooksFactory
declare function internal_createReactHooksFactory(): {
Provider: ({ children, client, queryClient, }: {
children?: ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
client: Client<any, any, any, any>;
queryClient: QueryClient;
}) => JSX.Element;
createClient: (opts: ClientArgs) => {
_rspc_def: {
queries: any;
mutations: any;
subscriptions: any;
};
query: <K extends any>(keyAndInput: [
key: K
] | [
K,
any
], opts?: _rspc_client.TRPCRequestOptions | undefined) => Promise<any>;
mutation: <K_1 extends any>(keyAndInput: [
key: K_1
] | [
K_1,
any
], opts?: _rspc_client.TRPCRequestOptions | undefined) => Promise<any>;
subscription: <K_2 extends any>(keyAndInput: [
key: K_2
] | [
K_2,
any
// … truncated, see the source link
Re-exports
internal:__useMutation
useMutation as __useMutation
internal:__useQuery
useQuery as __useQuery
