All quizzesMedium
Guards & Nested Routes
Preview — 3 of 10 questions
How do you define a route with an optional dynamic segment?
A{ path: '/users/[:id]', component: UserProfile }
B{ path: '/users/:id?', component: UserProfile }
C{ path: '/users/:id', optional: true, component: UserProfile }
D{ path: '/users/:id*', component: UserProfile }
How do you configure nested (child) routes in Vue Router?
AUse multiple <router-view> components in App.vue
BUse <router-view name="child"> in the parent component
CPrefix child routes with the parent path in the routes array
DUse the children array in the parent route definition, and add <router-view> in the parent component's template
What does the return value of a beforeEach guard control?
AThe return value has no effect; guards work via next() callback only
BReturning a string cancels navigation with an error message
CThe return value must always be true to allow navigation
DReturning false cancels navigation; returning a route location redirects; returning true or undefined proceeds
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.