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
eeeh I don't think I'm supposed to use hooks on the server side ⁉️
I think I'm supposed to do this:
https://trpc.io/docs/client/nextjs/server-side-helpers
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.
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...
Thank you!!