Recall & Review
beginner
What is the purpose of defining routes in a Vue application?
Defining routes lets you connect URLs to specific components. It helps users navigate different pages or views in the app without reloading the whole page.
Click to reveal answer
beginner
How do you define a simple route in Vue Router?
You create a route object with a
path and a component. For example: { path: '/home', component: Home } This means when the URL is '/home', the Home component shows.Click to reveal answer
intermediate
What is the role of
createRouter and createWebHistory in Vue Router?createRouter makes the router instance with all routes. createWebHistory tells Vue Router to use browser history mode, so URLs look clean without hashes (#).Click to reveal answer
intermediate
How can you define nested routes in Vue Router?
Nested routes are defined inside a route's
children array. Each child route has its own path and component. This lets you show components inside parent components.Click to reveal answer
intermediate
What happens if a user visits a URL that does not match any defined route?
You can define a 'catch-all' route with path
/:pathMatch(.*)* to show a 'Not Found' component. This handles unknown URLs gracefully.Click to reveal answer
Which Vue Router function creates the router instance?
✗ Incorrect
createRouter is used to create the router instance with routes and history mode.
What does the
path property in a route define?✗ Incorrect
The path defines the URL segment that triggers the route.
How do you define a nested route in Vue Router?
✗ Incorrect
Nested routes go inside the children array of a parent route.
Which history mode removes the hash (#) from URLs in Vue Router?
✗ Incorrect
createWebHistory uses the browser's history API for clean URLs without hashes.
What path pattern is used to catch all unmatched routes in Vue Router?
✗ Incorrect
The pattern /:pathMatch(.*)* matches any route not defined earlier.
Explain how to set up basic routing in a Vue application using Vue Router.
Think about how URLs connect to components and how Vue Router manages this.
You got /5 concepts.
Describe how nested routes work in Vue Router and why they are useful.
Imagine a page with tabs or sections inside it.
You got /4 concepts.