Performance: client:media for responsive interactivity
MEDIUM IMPACT
This affects how quickly interactive components respond to viewport changes and user input on different screen sizes.
<MyComponent client:media="(min-width: 768px)" /><MyComponent client:load />
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| client:load on all screens | High (all scripts loaded) | Multiple reflows if scripts modify DOM | High paint cost due to unnecessary event listeners | [X] Bad |
| client:media with media query | Low (scripts loaded conditionally) | Single reflow when media matches | Lower paint cost, fewer event listeners | [OK] Good |