Vue · Senior · Question 24 of 75
Which lifecycle hooks run during SSR?
- ✓Correct answer: Only setup code and
onServerPrefetch;onMounted/onUpdatedrun only in the browser - 2All hooks run on the server and again on the client
- 3No code runs on the server; only the template is compiled
Explanation
Avoid side effects in setup that need cleanup (timers, subscriptions) - onUnmounted never runs on the server, so they leak. Put them in onMounted.