Server state management in NextJS
Unanswered
Mini Satin posted this in #help-forum
Mini SatinOP
With RSC + Next.js caching, how do you manage server state, client caching, prefetching, optimistic updates, and invalidation—and when do you still reach for React Query/SWR/Apollo?
7 Replies
Blue orchard bee
In my experience, data that must be only "shown" in the client, and don't demand updates (ex: polling, retries), should be reserved to the server.
By RSC's model, anything that can be pre-fetched and cached, must be
I would reach to RQ if, for example, my data can be updated by an external system
I think it's always worth remembering RSC is a mean to provide availability on your data being already rendered
Sometimes RSC is good to just provide initial data to your UI, then you can update it with RQ or any stale while revalidate solutions.
Sometimes, depending of the user demographic and application I'm devving, I even just use RQ and forget completely about the server (greatly simplifies architecture)
If you're making a blog, and you're using a CMS, then it doesn't make sense to fetch much from the client.