Load data client-side via react-query while using tRPC with SSR
Is there any way to load data client-side when using tRPC? I want my page to be rendered and load data dynamically, since this data is not SEO-relevant. As far as I'm understanding as soon as I turn on SSR in tRPC queries must be done before the page is rendered.
7 Replies
Seems like a use case for ssg where you can put some queries on the server and some on the client
SSG Helpers | tRPC
createProxySSGHelpers provides you a set of helper functions that you can use to prefetch queries on the server.
which means I'd have to disable ssr right?
yes
I don't know why but it kinda feels weird to disable it. all examples have it on and not having getServerSideProps (or similar) really makes code a lot easier to follow
wait hold on you can disable ssr on a procedure level too
if most stuff are ssr
https://trpc.io/docs/v10/react-queries
oh, that's interesting. thanks!