Routing for Vues
Vue Router is the official routing library that maps URLs to components in a single-page app. Routes are defined with paths, params and nested children, navigation guards control access, and RouterLink and useRoute handle navigation. Data fetching strategies decide whether to load before or after the route renders.
Stage: App Architecture · Part of the Vue roadmap · Last reviewed 19 November 2026
What to learn in Routing
- Define routes with dynamic params and nested children
- Navigate with RouterLink and programmatic router.push
- Protect routes with navigation guards for logged-in users
- Fetch data on route entry and show loading and error states
- Lazy-load route components to split the bundle
Routing interview questions
How do navigation guards work in Vue Router?
Guards are functions that run before or after navigation, such as beforeEach globally or beforeEnter per route. They can allow, redirect or cancel navigation, which is how apps enforce login checks or load required data.
What is the difference between hash and history mode?
Hash mode puts the route after a # in the URL and needs no server setup. History mode uses clean URLs through the History API but the server must return the app's index.html for unknown paths.
Where Routing fits in the Vue roadmap
Routing belongs to the App Architecture stage (intermediate level), which takes about 19 hours. Routing and state.