Performance: Invalidation and reloading
HIGH IMPACT
This concept affects how fast the page updates when data changes and how much work the browser does to repaint content.
let count = 0; function increment() { count += 1; // Only update the reactive variable }
let state = { count: 0 }; function increment() { state = { ...state, count: state.count + 1 }; // Force full component reload by resetting all state }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full component invalidation | Many DOM updates | Multiple reflows | High paint cost | [X] Bad |
| Targeted reactive variable invalidation | Minimal DOM updates | Single reflow | Low paint cost | [OK] Good |