Skip to content
tRPC

Partners

Function: createTRPCProxyClient()

On this page

createTRPCProxyClient<TRouter>(opts): TRPCClient<TRouter>

Defined in: packages/client/src/createTRPCClient.ts:208

Creates a typed client for a router. Pass the router's type, and the links that send its calls.

Type Parameters

Type Parameter
TRouter extends AnyRouter

Parameters

ParameterType
optsCreateTRPCClientOptions<TRouter>

Returns

TRPCClient<TRouter>

Example

const client = createTRPCClient<AppRouter>({
  links: [httpBatchLink({ url: 'http://localhost:3000/trpc' })],
});
const post = await client.post.byId.query({ id: '1' });

See

https://trpc.io/docs/client/vanilla/setup#3-initialize-the-trpc-client