Skip to content

Commit 9657a47

Browse files
authored
Update keep-alive hook documentation (#1075)
Previously, the docs did not make clear that the activated hook is called for the entire component tree that is kept alive, and that mounted and unmounted are not called anywhere in that tree.
1 parent 2b84763 commit 9657a47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/api/built-in-components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
180180

181181
When wrapped around a dynamic component, `<keep-alive>` caches the inactive component instances without destroying them. Similar to `<transition>`, `<keep-alive>` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain.
182182

183-
When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly.
183+
When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly, providing an alternative to `mounted` and `unmounted`, which are not called. (This applies to the direct child of `<keep-alive>` as well as to all of its descendants.)
184184

185185
Primarily used to preserve component state or avoid re-rendering.
186186

0 commit comments

Comments
 (0)