Request context from getServerSideProps
The docs of tRPC context https://trpc.io/docs/v10/context
But how to use this function from
getServerSideProps
(in order to use SSG helpers)?Request Context | tRPC
The createContext() function is called for each request and the result is propagated to all resolvers. You can use this to pass contextual data down to the resolvers.
1 Reply
Use the
createContextInner
pattern
https://github.com/trpc/trpc/blob/next/examples/next-prisma-starter/src/server/context.ts