Performance: Spread props
MEDIUM IMPACT
Spread props affect how many attributes are added to DOM elements and how the browser processes them during rendering.
<Component id={props.id} class={props.class} aria-label={props['aria-label']} /><Component {...props} />| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Spread many props blindly | Many attribute insertions | Multiple reflows if styles affected | Higher paint cost due to larger DOM | [X] Bad |
| Explicitly pass needed props | Minimal attribute insertions | Single or no reflows | Lower paint cost with smaller DOM | [OK] Good |