Put in order · Vue.js course · Module 8: Slots & Dynamic Components

Steps for creating a dynamic component

Order the steps for implementing a dynamic component:

Items to put in order

  • Create a ref currentComponent pointing to the active component
  • Add buttons that change currentComponent
  • Use <component :is="currentComponent" /> in the template
  • Import all components (OxygenPanel, WaterPanel)

You can check the correct answer by solving this task in the CodeWorlds game.