Vue Nuxt
Tips & Tricks

A collection of Vue, Nuxt and Vite tips, tricks and good practices.

In Vue.js, an active component instance will be unmounted when switching away from it by default. But what if you want to preserve the state when switching components? You can wrap it with the built-in <KeepAlive> component to preserve and cache the state. πŸ’ͺ🏻

<template>
<KeepAlive>
  <component :is="activeComponent" />
</KeepAlive>
</template>