Vue · Middle · Question 27 of 75
What does <KeepAlive> do?
<KeepAlive :max="5">
<component :is="currentTab" />
</KeepAlive>- ✓Correct answer: Caches inactive component instances so their state survives switching
- 2Keeps the WebSocket connection alive
- 3Prevents the component from being garbage-collected forever
Explanation
Cached components receive onActivated/onDeactivated instead of being unmounted. include, exclude and max control what is cached.