Vue · Junior · Question 37 of 75

How do you switch between several components dynamically?

<component :is="tabs[current]" />

Explanation

:is accepts an imported component or a registered component name. When switching, the old component is unmounted unless it is wrapped in <KeepAlive>.

Further reading

Problem with a question

Vue · Junior · question 37

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz