All quizzesHard
Router Internals
Preview — 3 of 10 questions
How would you implement a custom history mode for Vue Router?
APass a customHistory object to createRouter with push, replace, and go methods
BExtend createWebHistory with additional methods via JavaScript class inheritance
CImplement the RouterHistory interface with base, location, state, push, replace, go, listen, and destroy methods using createCustomHistory
DUse router.beforeEach to intercept and override the default history behavior
How does Vue Router's Composition API handle SSR where window is unavailable?
AIt automatically detects SSR and uses a no-op implementation for browser APIs
BcreateMemoryHistory() is used on the server; the router.push(url) call sets the initial route before rendering; createWebHistory() is used on the client
CVue Router is not usable in SSR — use Nuxt for server-side routing
DBoth createWebHistory and createWebHashHistory work transparently in SSR
How do you create reusable navigation guard factories for complex authorization?
AUse beforeEach with a long if/else chain inside it
BCreate guard factory functions that return guard functions, composing them in route beforeEnter arrays
CUse a global Pinia store to manage all navigation permissions
DTypeScript interfaces are the only way to enforce guard composition
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.