Performance: Functional components
MEDIUM IMPACT
Functional components affect rendering speed and memory usage by reducing component overhead in Vue apps.
<script setup> export default (props) => { return h('div', props.text) } </script>
<script> export default { name: 'BadComponent', data() { return { count: 0 } }, template: `<div>{{ count }}</div>` } </script>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full component with state | More nodes due to reactive wrappers | Multiple reflows if state changes | Higher paint cost due to updates | [X] Bad |
| Functional component (stateless) | Minimal nodes, no reactive wrappers | Single reflow per render | Lower paint cost | [OK] Good |