Performance: JSX in Vue components
MEDIUM IMPACT
Using JSX in Vue components affects the rendering speed and bundle size due to how templates are compiled and how the virtual DOM updates.
import { defineComponent } from 'vue' export default defineComponent({ render() { return <div>{this.title} {this.subtitle}</div> } })
export default { render() { return h('div', this.title + ' ' + this.subtitle) } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual render function with h() | Moderate | Multiple per update | Medium | [!] OK |
| JSX in Vue components | Moderate | Few to moderate | Medium | [OK] Good |
| Vue SFC templates | Minimal | Minimal | Low | [OK] Good |