rembrembdocs

Version: 11.x

The "Vanilla" tRPC client can be used to call your API procedures as if they are local functions, enabling a seamless development experience.

ts

import { createTRPCClient, httpBatchLink } from '@trpc/client';

import type { AppRouter } from './server';

const client = createTRPCClient<AppRouter>({

links: [httpBatchLink({ url: 'http://localhost:3000' })],

});

const bilbo = await client.getUser.query('id_bilbo');

// => { id: 'id_bilbo', name: 'Bilbo' };

When to use the Vanilla Client?

You are likely to use this client in two scenarios:

When NOT to use the Vanilla Client?