Recall & Review
beginner
What is Vue Router used for in a Vue.js application?
Vue Router helps you create different pages or views in your Vue app and lets users move between them without reloading the page.
Click to reveal answer
beginner
How do you install Vue Router in a Vue 3 project?
You run
npm install vue-router@4 or yarn add vue-router@4 to add Vue Router version 4, which works with Vue 3.Click to reveal answer
intermediate
What is the purpose of
createRouter and createWebHistory in Vue Router setup?createRouter creates the router instance that controls navigation. createWebHistory tells the router to use browser history mode for clean URLs without hashes.Click to reveal answer
beginner
Where do you add the router to your Vue app?
You add the router to your app by calling
app.use(router) before mounting the app with app.mount('#app').Click to reveal answer
beginner
What component do you use in your template to display the matched route's component?
You use the
<router-view> component in your template. It shows the component for the current route.Click to reveal answer
Which command installs Vue Router version 4 for Vue 3?
✗ Incorrect
Vue Router version 4 is designed for Vue 3, so you install it with
npm install vue-router@4.What does
createWebHistory() do in Vue Router?✗ Incorrect
createWebHistory() uses the browser's history API to create clean URLs without hashes.Where should you place
app.use(router) in your Vue app setup?✗ Incorrect
You must add the router to the app with
app.use(router) before calling app.mount().Which component renders the matched route's component in Vue Router?
✗ Incorrect
What is the first step after installing Vue Router to set it up?
✗ Incorrect
After installing, you create a router instance with your route definitions using
createRouter.Explain the steps to install and set up Vue Router in a new Vue 3 project.
Think about installation, router creation, app integration, and template usage.
You got /7 concepts.
Describe the role of and how it works with Vue Router.
Focus on how Vue Router shows different pages inside your app.
You got /4 concepts.