await TRPC's useQuery

I want to use trpc's useQuery on the server side (in getServerProps) is it possible to await for data to arrive before returning? i.e. await api.auth.checkLogin.useQuery()?
4 Replies
West side ⁉
West side ⁉OP16mo ago
eeeh I don't think I'm supposed to use hooks on the server side ⁉️
West side ⁉
West side ⁉OP16mo ago
Server-Side Helpers | tRPC
The server-side helpers provides you with a set of helper functions that you can use to prefetch queries on the server. This is useful for SSG, but also for SSR if you opt not to use ssr: true.
Aland
Aland16mo ago
Yes you can use trpc on the server, watch this video he explains how it's done. https://www.youtube.com/watch?v=iHJuJdw1jEM
Josh tried coding
YouTube
Wait, I REALLY Underestimated This Tool
That is just awesome man. I think ima just switch back completely for my projects going forward, it really feels like just getting back with your ex lol. Even though server-actions make some people question the need for tRPC, I think it still has a place. At least for now (?) -- my links Next.js SaaS: https://www.splitter.gg/ Discord: https://d...
West side ⁉
West side ⁉OP16mo ago
Thank you!!
Want results from more Discord servers?
Add your server