Performance: Why SSR matters for Vue
HIGH IMPACT
SSR affects how fast the main content appears on screen and improves user interaction speed by pre-rendering HTML on the server.
import { createSSRApp } from 'vue' import { renderToString } from 'vue/server-renderer' export async function render() { const app = createSSRApp(App) return await renderToString(app) }
const app = Vue.createApp(App) app.mount('#app')
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Client-only Vue rendering | Delayed DOM creation until JS runs | Multiple reflows as JS builds DOM | High paint cost due to late DOM | [X] Bad |
| Vue SSR rendering | DOM created from server HTML immediately | Single reflow on initial load | Lower paint cost with ready content | [OK] Good |