Question · Vue.js course · Module 8: Slots & Dynamic Components

Purpose of KeepAlive

What does the <KeepAlive> component do when wrapping a dynamic component?

Answer options

  • Prevents the DOM element from being removed from the tree
  • Caches the component instance, preserving its state after switching
  • Creates a backup copy of the component's data
  • Synchronizes state between components

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