Performance: Why props pass data to children
MEDIUM IMPACT
Passing data via props affects how efficiently components update and render in the browser.
<ChildComponent {smallProp} />
<script>
export let smallProp;
</script><ChildComponent {largeObject} />
<script>
export let largeObject;
</script>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Passing large objects as props | Many updates to child DOM | Multiple reflows per update | High paint cost due to layout changes | [X] Bad |
| Passing minimal, specific props | Few DOM updates | Single or no reflows | Low paint cost | [OK] Good |