tRPC without SSR
When using tRPC with ssr it uses
getInitialProps
, which has kinda of a cool effect in terms how a page is rendered, since it's rendered server-side on initial requests and client-side on route transitions.
Unfortunately, enabling ssr means that you can no longer use getServerSideProps
(which I know is only fixable by next.js and not tRPC). But how to replicate the getInitialProps
behaviour then?
Let's say I'm building a blog; due to SEO it's basically necessary to render my posts server-side. But when navigating through the site loading posts on the fly would be totally fine. How to do that without ssr
?12 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Response Caching | tRPC
The below examples uses Vercel's edge caching to serve data to your users as fast as possible.
Server-Side Rendering | tRPC
To enable SSR just set ssr: true in your createTRPCNext config callback.
all info should be in those 2 pages
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You can use gSSP if you prefer all route changes to be slowed down
RSC will come soon and hopefully fix all this stuff.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Fwiw, benefit to not using our ssr is to be able to use Suspense
Suspense (Experimental) | tRPC
- useSuspense & useSuspenseInfiniteQuery are experimental features as its implementation may change as a result of the use() proposal & RSC (React Server Components)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
umm if you're okay with doing an SPA, yes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View