Server Side Rendering
This is from the tRPC documentation on server side rendering. Does anyone know where the createcontext come from in T3 design? I can't seem to find it.
import { createServerSideHelpers } from '@trpc/react-query/server';
import { GetServerSidePropsContext, InferGetServerSidePropsType } from 'next';
import { createContext } from 'server/context';
import { appRouter } from 'server/routers/_app';
import superjson from 'superjson';
import { trpc } from 'utils/trpc';
export async function getServerSideProps(
context: GetServerSidePropsContext<{ id: string }>,
) {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: await createContext(),
transformer: superjson,
});
const id = context.params?.id as string;
1 Reply
I found createTRPCContext but that takes constructor parameters I dont have access to