From d4ff46617f2066fac31f91becbeab768ae57f2c3 Mon Sep 17 00:00:00 2001 From: Tyler Mercer <40773575+tylermercer@users.noreply.github.com> Date: Sat, 29 May 2021 08:51:15 -0600 Subject: [PATCH] Update keep-alive hook documentation 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. --- src/api/built-in-components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/built-in-components.md b/src/api/built-in-components.md index 23ec5f2578..1e5b1dd454 100644 --- a/src/api/built-in-components.md +++ b/src/api/built-in-components.md @@ -180,7 +180,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue' When wrapped around a dynamic component, `` caches the inactive component instances without destroying them. Similar to ``, `` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain. - When a component is toggled inside ``, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly. + When a component is toggled inside ``, 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 `` as well as to all of its descendants.) Primarily used to preserve component state or avoid re-rendering.