Performance: Select bindings
MEDIUM IMPACT
This affects how quickly the UI updates when a user selects an option and how efficiently the DOM reflects the selected value.
let selected; <select bind:value={selected}> <option value="apple">Apple</option> <option value="banana">Banana</option> <option value="cherry">Cherry</option> </select>
let selected; function handleChange(event) { selected = event.target.value; } <select on:change={handleChange}> <option value="apple">Apple</option> <option value="banana">Banana</option> <option value="cherry">Cherry</option> </select>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual event handler for select change | Multiple event listeners | Triggers reflow on each change | Moderate paint cost | [X] Bad |
| Svelte bind:value on select | Single reactive update | Minimal reflows, only if layout changes | Low paint cost | [OK] Good |