Performance: Events for child to parent communication
MEDIUM IMPACT
This concept affects interaction responsiveness and rendering updates when child components notify parents.
<ChildComponent @customEvent="handleEvent" /> // Inside ChildComponent this.$emit('customEvent', data) // Parent method updates only necessary reactive state
<ChildComponent @customEvent="parentMethod" /> // Inside ChildComponent this.$emit('customEvent', data) // Parent method triggers heavy state changes or multiple DOM updates unnecessarily
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Parent updates many reactive states on child event | High (many nodes affected) | Multiple reflows | High paint cost | [X] Bad |
| Parent updates minimal reactive state on child event | Low (few nodes affected) | Single reflow | Low paint cost | [OK] Good |