codejump

v-memo & v-once

Preview — 3 of 10 questions

When should you use v-show instead of v-if?

AAlways use v-show — it's faster than v-if in all cases
BUse v-show only for CSS animations; use v-if for all other conditional rendering
CUse v-show for elements that toggle frequently; use v-if for elements that are rarely shown or have complex child trees
Dv-show and v-if are identical — the choice is purely stylistic

What is the purpose of the key attribute in v-for loops?

AIt is required by the browser to identify list items for accessibility
BIt prevents the list from re-rendering when other components update
CIt helps Vue's Virtual DOM algorithm efficiently identify which items changed, were added, or removed
DIt enables CSS animations on list items automatically

Why should you use computed properties instead of methods for derived data in templates?

AComputed properties run faster because they use Web Workers internally
BComputed properties are cached based on reactive dependencies — they only re-run when dependencies change
CMethods in templates are not supported — computed is the only option
DComputed properties work with TypeScript; methods do not

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.