Handling Routing with Vue Router
Single-page applications (SPAs), such as the one offered by Vue.js, provide an architecture built upon a single page. This methodology prevents the page from fully reloading and offers an improved user experience.
As your application grows, you will find the need to create different views in your application. Even if the term SPA can lead to the understanding that your application will be built on a single page, the truth is far from it.
Most frameworks, including Vue.js, offer packages aimed at recreating the routing system available in other frameworks such as PHP, .NET, and more. The routing functionality offered by SPA frameworks provides the best of both worlds. It offers developers a complete routing toolkit, while still providing the same user experience expected by SPA frameworks. The router package used in Vue.js is called vue-router.
In this chapter, you will learn how to use routing in your Vue.js application. At the end of the chapter...