Performance: Sharing state between framework islands
MEDIUM IMPACT
This affects page interactivity speed and smoothness by how efficiently state updates propagate between isolated UI parts.
Use a centralized state store or context shared via lightweight messaging or props passed from Astro root.
Each island fetches and updates shared state independently via global events or polling.
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Independent state updates per island | Multiple DOM updates | Multiple reflows (N times) | High paint cost | [X] Bad |
| Centralized shared state with selective updates | Minimal DOM updates | Single reflow | Low paint cost | [OK] Good |