Can I use tRPC useQuery inside getServerSideProps?

getServerSideProps is supposed to be async. Since the useQuery calls are synchronous, I get a type error:
Async function 'getServerSideProps' has no 'await' expression.
Async function 'getServerSideProps' has no 'await' expression.
My end goal is to have a SSR component who's props are fetched via tRPC.
2 Replies
cje
cje2y ago
Christopher Ehrlich
YouTube
Advanced tRPC - Callers, functions, and gSSP
Repo for this video: https://github.com/c-ehrlich/you-dont-need-callers If you want to use schema in the frontend, they cannot be imported from the same file as things that run specifically in the backend. One solution would be to put them into a procedureName.schema.ts or similar file. tRPC: https://trpc.io/docs Create T3 App: https://crea...
DYELbrah
DYELbrah2y ago
Thank you so much, was reading through more threads and found out I need to use SSG... You're a G for linking the exact part of the video lol ❤️
Want results from more Discord servers?
Add your server