0
0
Vueframework~5 mins

Keep-alive for expensive components in Vue - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the component in Vue?
The component caches inactive components to avoid re-rendering them, improving performance for expensive components.
Click to reveal answer
beginner
How does improve user experience with expensive components?
By caching components, lets users switch back without waiting for the component to reload or fetch data again.
Click to reveal answer
intermediate
Which Vue lifecycle hooks are called when a component is activated or deactivated inside ?
The activated() hook runs when the component is inserted back, and deactivated() runs when it is cached but hidden.
Click to reveal answer
intermediate
How can you control which components caches?
Use the include and exclude props with component names or regex patterns to specify which components to cache or ignore.
Click to reveal answer
beginner
What happens if you don’t use for expensive components?
The component will be destroyed and recreated every time it is switched, causing delays and repeated data fetching.
Click to reveal answer
What does the component do in Vue?
ARemoves components from the DOM permanently
BCaches inactive components to improve performance
CAutomatically updates component data
DPrevents components from rendering
Which lifecycle hook runs when a cached component becomes active again inside ?
Acreated()
Bmounted()
Cactivated()
Ddeactivated()
How can you specify which components should cache?
AUsing the include and exclude props
BUsing the v-if directive
CUsing the v-show directive
DUsing the ref attribute
What is a common use case for ?
AStyling components dynamically
BLoading external scripts
CHandling user input events
DCaching expensive components like charts or forms
What happens to a component inside when it is not active?
AIt remains cached but hidden
BIt reloads data automatically
CIt is destroyed and removed from memory
DIt becomes read-only
Explain how works in Vue and why it is useful for expensive components.
Think about switching tabs or views without waiting for reload.
You got /4 concepts.
    Describe how to control which components are cached by and mention relevant lifecycle hooks.
    Focus on props and lifecycle hooks related to caching.
    You got /4 concepts.