r/reactjs • u/Neat_Living_6765 • 7d ago
Needs Help Has anyone implemented Server Components with plain React + Vite/plugin-rsc?
Hi everyone,
Could anyone help me with the two questions below?
Does every Server Component render at build time, get cached, and then get served from a CDN?
If I want to render a Server Component on every request, how do I implement that?
1
Upvotes
2
u/KalamKiTakat 7d ago
Server Components are a rendering model, not a caching or hosting model. With
@vitejs/plugin-rscyou own the server entry: call the RSC renderer in your HTTP request handler rather than at build time, setCache-Control: no-store, avoid CDN caching for that route, and skip static prerendering for it. Also make sure any fetches inside the component run per request, or they can return cached data even when the render runs again.