Vue · Junior · Question 37 of 75
How do you switch between several components dynamically?
<component :is="tabs[current]" />- ✓Correct answer: With the built-in
<component :is="...">element - 2With
v-ifonly; dynamic components don't exist - 3With
<slot :is="...">
Explanation
:is accepts an imported component or a registered component name. When switching, the old component is unmounted unless it is wrapped in <KeepAlive>.