Question · Vue.js course · Module 2: Template Syntax
Template Best Practices
Which practice is recommended in Vue templates?
Answer options
- Use index as :key in v-for
- Do not use directive shorthands
- Always use v-if instead of v-show
- Use a unique :key in v-for and avoid v-if with v-for on the same element
Show the answer
Correct answer:
- Use a unique :key in v-for and avoid v-if with v-for on the same element