You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The built-in components `KeepAlive`, `Transition`, `TransitionGroup`, and `Teleport` can all be passed to `is`, but you must register them if you want to pass them by name. For example:
Registration is not required if you pass the component itself to `is` rather than its name.
64
66
65
-
-**key:**
67
+
-**Usage with VNodes:**
66
68
67
-
When using <component:is="vnode"> and passing vnode of the same type, you need to provide keys:
68
-
69
-
```html
70
-
<component:is="current":key="selected" />
71
-
```
69
+
In advanced use cases, it can sometimes be useful to render an existing VNode via a template. Using a `<component>` makes this possible, but it should be seen as an escape hatch, used to avoid rewriting the entire template as a `render` function.
70
+
71
+
```html
72
+
<component:is="vnode":key="aSuitableKey" />
73
+
```
72
74
73
-
Otherwise, you are passing two compiled vnodes of the same type to the renderer. Because they are compiled as completely static, they will not be updated at all.
75
+
A caveat of mixing VNodes and templates in this way is that you need to provide a suitable `key` attribute. The VNode will be considered static, so any updates will be ignored unless the `key` changes. The `key` can be on the VNode or the `<component>` tag, but either way it must change every time you want the VNode to re-render. This caveat doesn't apply if the nodes have different types, e.g. changing a `span` to a `div`.
0 commit comments