Vue · Middle · Question 33 of 75
Why doesn't the page update when navigating from /users/1 to /users/2?
- ✓Correct answer: The same component instance is reused, so code that read the param once in setup doesn't re-run
- 2Vue Router caches pages by default
- 3Params can't change without a reload
Explanation
React to param changes with watch(() => route.params.id, load, { immediate: true }) or onBeforeRouteUpdate. Alternatively force a remount with <RouterView :key="route.fullPath" />.