0
0
Vueframework~5 mins

Vue Router installation and setup - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Anpm install vue-router@4
Bnpm install vue-router@3
Cnpm install vue-router
Dnpm install vue-router@5
What does createWebHistory() do in Vue Router?
AEnables hash-based URLs
BDefines routes
CEnables browser history mode for clean URLs
DCreates a new Vue app
Where should you place app.use(router) in your Vue app setup?
AAfter mounting the app
BIn the main component's template
CInside the router file
DBefore mounting the app
Which component renders the matched route's component in Vue Router?
A<router-link>
B<router-view>
C<router-route>
D<router-display>
What is the first step after installing Vue Router to set it up?
ACreate a router instance with routes
BAdd <router-view> in HTML
CCall app.mount()
DWrite components
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.