Performance: Passing arguments to handlers
MEDIUM IMPACT
This affects interaction responsiveness and rendering speed when event handlers receive arguments in Vue components.
<button @click="handleClick" :data-id="item.id">Click</button> // In script function handleClick(event) { const id = event.currentTarget.dataset.id; // handle click with id }
<button @click="() => handleClick(item.id)">Click</button>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline arrow function in template | No extra DOM nodes | 0 | Low | [X] Bad |
| Stable handler with data attributes | No extra DOM nodes | 0 | Low | [OK] Good |