Caching loaders in React Router v7
Looked into React Router v7. The RSC support is amazing as well, and I agree with the perspective of calling db on "render".
Now just wanted to know about caching? I think the biggest reason for wide adoption of React Query was for it's Cache which made it seem fast to the user.
Now, is there like some example where we can combine the best of both worlds and store the loader data from route into the useQuery as a Cache? Cuz that's what I've read in a tweet showed in one of Theo's videos.
Or we supposed to use a CDN? I understand clientLoaders can use HTTP Caching. But what about the server loaders ? Especially RSCs?
Could not find any resource about caching anywhere. Would be great help if anyone could explain how this can be achieved. I would then present it in my company so that we can use RSCs to cut out TTFB on user's home page n other "non changing" data pages. ( Not a forced rewrite, we will be revamping our entire app & founder has asked me thinks of ways of making the existing Frontend experience faster )
Thank you!
0 Replies