Performance: Why Astro supports multiple frameworks
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by optimizing how frameworks are loaded and rendered.
--- import ReactComponent from './ReactComponent.jsx'; import VueComponent from './VueComponent.vue'; import SvelteComponent from './SvelteComponent.svelte'; --- <div> <ReactComponent client:load /> <VueComponent client:idle /> <SvelteComponent client:visible /> </div>
--- import ReactComponent from './ReactComponent.jsx'; import VueComponent from './VueComponent.vue'; import SvelteComponent from './SvelteComponent.svelte'; --- <div> <ReactComponent client:load /> <VueComponent client:load /> <SvelteComponent client:load /> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Load all frameworks fully on client | High (many nodes from multiple frameworks) | Multiple reflows per framework | High paint cost due to large JS | [X] Bad |
| Partial hydration with client directives | Low (only interactive parts hydrated) | Single reflow per hydrated component | Lower paint cost with smaller JS | [OK] Good |