# Function: createTRPCClient()

> 

> **createTRPCClient**\<`TRouter`\>(`opts`): [`TRPCClient`](https://trpc.io/docs/typedoc/react-query/index/type-aliases/TRPCClient.md)\<`TRouter`\>

Defined in: packages/client/dist/index.d.mts:245

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

| Parameter | Type |
| ------ | ------ |
| `opts` | `CreateTRPCClientOptions`\<`TRouter`\> |

## Returns

[`TRPCClient`](https://trpc.io/docs/typedoc/react-query/index/type-aliases/TRPCClient.md)\<`TRouter`\>

## Example

```ts
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
