Vue · Senior · Question 10 of 75
Why are templates generally preferred over hand-written render functions in Vue?
- ✓Correct answer: The compiler can optimize templates (static hoisting, patch flags), while render functions are opaque to it
- 2Render functions are not supported in Vue 3
- 3Templates run on a separate thread
Explanation
Render functions and JSX are useful for highly dynamic output (e.g. a library rendering arbitrary trees), but you lose compile-time optimizations.