Function: ~~withTRPC()~~
On this page
withTRPC<
TRouter,TSSRContext>(opts): (AppOrPage) =>NextComponentType
Defined in: withTRPC.tsx:162
Wraps a Next.js app or page with the tRPC and TanStack Query providers.
createTRPCNext returns it, and you wrap your app with it:
export default trpc.withTRPC(MyApp).
Type Parameters
| Type Parameter | Default type |
|---|---|
TRouter extends AnyRouter | - |
TSSRContext extends NextPageContext | NextPageContext |
Parameters
| Parameter | Type |
|---|---|
opts | WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter> |
Returns
Function
Parameters
| Parameter | Type |
|---|---|
AppOrPage | NextComponentType<any, any, any> |
Returns
NextComponentType
Deprecated
built on @trpc/react-query, which only gets bug fixes. Mount
TRPCProvider from @trpc/tanstack-react-query in _app instead.
See
https://trpc.io/docs/client/nextjs/pages-router/setup#moving-from-createtrpcnext