# Function: ~~createTRPCNext()~~

> 

> **createTRPCNext**\<`TRouter`, `TSSRContext`\>(`opts`): `ProtectedIntersection`\<`CreateTRPCNextBase`\<`TRouter`, `TSSRContext`\>, `DecorateRouterRecord`\<`TRouter`\[`"_def"`\]\[`"_config"`\]\[`"$types"`\], `TRouter`\[`"_def"`\]\[`"record"`\]\>\>

Defined in: [createTRPCNext.tsx:87](https://github.com/trpc/trpc/blob/7c907acfd8b31929214792e3b8c2ad7a8ac72563/packages/next/src/createTRPCNext.tsx#L87)

Creates typed React hooks and a `withTRPC` wrapper for a Next.js Pages Router app.

## Type Parameters

| Type Parameter | Default type |
| ------ | ------ |
| `TRouter` *extends* `AnyRouter` | - |
| `TSSRContext` *extends* `NextPageContext` | `NextPageContext` |

## Parameters

| Parameter | Type |
| ------ | ------ |
| `opts` | [`WithTRPCNoSSROptions`](https://trpc.io/docs/typedoc/next/type-aliases/WithTRPCNoSSROptions.md)\<`TRouter`\> \| [`WithTRPCSSROptions`](https://trpc.io/docs/typedoc/next/type-aliases/WithTRPCSSROptions.md)\<`TRouter`\> |

## Returns

`ProtectedIntersection`\<`CreateTRPCNextBase`\<`TRouter`, `TSSRContext`\>, `DecorateRouterRecord`\<`TRouter`\[`"_def"`\]\[`"_config"`\]\[`"$types"`\], `TRouter`\[`"_def"`\]\[`"record"`\]\>\>

## Example

```ts
export const trpc = createTRPCNext<AppRouter>({
  config() {
    return { links: [httpBatchLink({ url: '/api/trpc' })] };
  },
});
```

## Deprecated

built on `@trpc/react-query`, which only gets bug fixes. Use
`createTRPCContext` from `@trpc/tanstack-react-query` instead.

## See

https://trpc.io/docs/client/nextjs/pages-router/setup#moving-from-createtrpcnext
