Help with Next.js 15 App Router + tRPC + Tanstack Query
So, recently, I started learning the Holy T3 Stack(coz I bought a macbook recently, and I was like - why not become a soy dev!).
So, I learned T3 Stack basics, like tRPC(setting it up in express, a vanilla TS project, then querying and mutation concepts), after that went on to TanStack Query(got my mind blown, that why from last 1.5 years I didn't use it in my React/Next apps!). And I know enough TS to write projects.
So, I started with my Todo project for learning ofc(NOT gonna put it in my resume!).
So, there's this
Secondly, how do I use tanstack query and tanstack RPC together, like do I make every component a "client component"(which is very weird coz Next.js makes Server Components so handy!) and then use the
Thirdly, if I use the
May React Gods bless all of us!
So, I learned T3 Stack basics, like tRPC(setting it up in express, a vanilla TS project, then querying and mutation concepts), after that went on to TanStack Query(got my mind blown, that why from last 1.5 years I didn't use it in my React/Next apps!). And I know enough TS to write projects.
So, I started with my Todo project for learning ofc(NOT gonna put it in my resume!).
So, there's this
HydrateClient component, which was in app/page.tsx, so I have a doubt, that, why NOT have it in the root layout/layout.tsx(its purpose is to hydrate the client components that come under it after making a request, then why NOT in layout.tsx and why in the page.tsx?), and should I put it in every page.tsx instead of layout.tsx if I wanna Hydrate the client and NOT pass the server fetched data as a prop?Secondly, how do I use tanstack query and tanstack RPC together, like do I make every component a "client component"(which is very weird coz Next.js makes Server Components so handy!) and then use the
initialData prop inside the useQuery to populate the initial data?Thirdly, if I use the
initalData prop then will it give me the holy grail of SSR or I'll be stuck with the hellish domain of CSR?(Although, from what I read/watched on YT, they say it provides SSR and can be seen in the Page Source Response, my question is, can the spiders/web crawlers read and understand it, coz then only it'll benefit the SEO!)May React Gods bless all of us!
