20
Vue Router Patterns
Routing is a vitally important part of any Single Page Application (SPA). This chapter
focuses on maximizing the Vue router and looks at everything from routing a user between
pages, to parameters, to optimal configuration.
By the end of this chapter, we will have covered the following:
Implementing routing in a Vue.js application
Using dynamic route matching to create route parameters
Passing route parameters as component props
Single Page Applications
Modern JavaScript applications implement a pattern known as an SPA. In its most
simplistic form, it can be thought of as an application that displays components based on a
URL. As the templates are mapped to routes, there is no need for a page reload, as they can
be injected depending on where the user navigated.
This is the job of the router.
By creating our application this way, we're able to increase both perceived and actual
speed, because our application is much more dynamic.