Performance: Progressive enhancement
MEDIUM IMPACT
Progressive enhancement improves initial page load speed and interaction responsiveness by delivering a basic functional experience first, then layering advanced features.
export default function Page() {
return (
<main>
<h1>Basic content visible immediately</h1>
<noscript>Please enable JavaScript for enhanced features.</noscript>
</main>
);
}
// Then progressively enhance with client-side JS for interactivityimport { useEffect } from 'react'; export default function Page() { useEffect(() => { // heavy JS feature initialization initializeComplexUI(); }, []); return <div>{/* complex UI only rendered after JS loads */}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy JS blocking initial render | Minimal initially, then large | Multiple reflows as JS modifies DOM | High paint cost after JS loads | [X] Bad |
| Server-rendered HTML with deferred JS | Full DOM ready on load | Single reflow on initial load | Low paint cost, fast first paint | [OK] Good |