yaba101
yaba101
Explore posts from servers
TTCTheo's Typesafe Cult
Created by ethan on 11/2/2023 in #questions
Best way to prefetch queries with tRPC and app/ dir
@Endgame1013 can we have repo for this, because I don't get the import { createSSRHelper } from '@/server/api/ssr'; implementation
11 replies
TtRPC
Created by yaba101 on 12/4/2023 in #❓-help
How can I Prefetch on client or server component on App router Nextjs?
what is the equivalent implementation of this in app router? export const getServerSideProps: GetServerSideProps = async (context) => { const { req, res } = context; const ssg = await createSSG({ req, res }); await ssg.teams.get.prefetch(); await ssg.user.get.prefetch(); const slug = TeamRouteQueryType.parse(context.query).team; // pass team into this promise for ssg prefetch of different team-based routes await Promise.allSettled([ ssg.teams.getApiKey.prefetch({ slug: slug, }), ]); return { props: { trpcState: ssg.dehydrate(), }, }; };
2 replies