0
0
Vueframework~5 mins

Keep-alive for caching 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 Vue components, preserving their state and avoiding re-rendering when they are switched back into view.
Click to reveal answer
beginner
How do you wrap components to enable caching with ?
You wrap dynamic components or router views inside tags, like <component :is="currentView" />.
Click to reveal answer
intermediate
What props can you use with to control which components are cached?
You can use include and exclude props with component names to specify which components to cache or ignore.
Click to reveal answer
intermediate
What lifecycle hooks are triggered when a component is cached and then activated again?
When cached, the component's deactivated hook runs when hidden, and activated runs when it becomes active again.
Click to reveal answer
beginner
Why is useful for improving user experience in Vue apps?
It speeds up navigation by reusing component state and DOM, reducing loading time and preserving user input or scroll position.
Click to reveal answer
What does the component do in Vue?
AAutomatically reloads components on every render
BRemoves components from the DOM permanently
CCaches inactive components to preserve their state
DConverts components into plain HTML
Which prop of lets you specify components to cache?
Ainclude
Bexclude
Ccache
Dpreserve
Which lifecycle hook runs when a cached component becomes active again?
Amounted
Bactivated
Ccreated
Ddeactivated
How do you use with dynamic components?
AWrap the dynamic component inside <keep-alive> tags
BAdd a cache attribute to the component
CUse a special caching plugin
DNo special action is needed
What benefit does provide to user experience?
ASlower navigation but better visuals
BRemoves all component data on switch
CAutomatically fixes bugs in components
DPreserves component state and speeds up navigation
Explain how works in Vue and why you would use it.
Think about how to keep a component's data and appearance when switching views.
You got /4 concepts.
    Describe the lifecycle hooks related to and their roles.
    Focus on what happens when a cached component hides and shows.
    You got /4 concepts.