What to use instead of "getServerSideProps" in NextJS?

As most of you might be aware of getServerSideProps is slow and hard to use. Is there a better alternative method to use instead? Like using react-query maybe? I am not sure about it. I'd appreciate any recommendation 🙏
6 Replies
dan
dan2y ago
use trpc if you can. if you can’t for whatever reason then i’d recommend creating api routes and using react query. or if you want to use newer tech try out app dir and server components
omerayhan
omerayhanOP2y ago
but is it server side or client side request?
dan
dan2y ago
trpc: without ssr enabled: clients gets rendered page, page hydrates on client and trpc wouls request backend for the data trpc with ssr: trpc would fetch data on the ssr request (not sure on the specifics of this. never used it) and client receives it react query works the same way as trpc without ssr app dir & server components are all server side.
omerayhan
omerayhanOP2y ago
so in conclusion trpc with ssr acts similar to getServerSideProps but with better features?
dan
dan2y ago
afaik yes. You’ll have to try it since i’ve never personally used it.
omerayhan
omerayhanOP2y ago
alright thanks for the suggestion @dan I'll keep this question open a bit more to see what others can say
Want results from more Discord servers?
Add your server