Performance: Passing styles to components (--style-props)
MEDIUM IMPACT
This affects rendering speed and visual stability by controlling how styles are applied and updated in component trees.
<ChildComponent style={{ color: 'red', fontSize: '1.2rem' }} /><ChildComponent style="color: red; font-size: 1.2rem;" />| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline style string props | Minimal DOM nodes | Triggers 1 reflow per update | Medium paint cost | [X] Bad |
| Style object props | Minimal DOM nodes | Single reflow per batch update | Lower paint cost | [!] OK |
| CSS class usage | Minimal DOM nodes | No reflows from style changes | Lowest paint cost | [OK] Good |