Performance: Component bindings
MEDIUM IMPACT
Component bindings affect how quickly the UI updates in response to user input or data changes, impacting interaction responsiveness.
<Child value={parentValue} on:valueChange={e => parentValue = e.detail} />
<script>
let parentValue = '';
</script><Child bind:value={parentValue} />
<script>
let parentValue = '';
</script>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Two-way bind:value | High (updates on every input) | Multiple per keystroke | High (many repaints) | [X] Bad |
| One-way value + event handler | Lower (updates only on change) | Few | Lower | [OK] Good |