The Composition API Masterclass is out!
Sign-up for the Vue.js Masterclass 2024 Edition.
In this lesson, we're learning how to force the vue router to destroy the component when we're navigating to another route that are using the same "PageComponent". This is important when you're relying on Vue's lifecycle hooks, for example as we do to fetch vital data from our database.
If we do not force the vue router to destroy the current component when we're navigating to another route, the router will try to be smart and just swap the props and the URL. This means that a new component will not be created and the lifecycle hook not fired!