yaba101
yaba101
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