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
Copy file name to clipboardExpand all lines: active-rfcs/0000-render-function-api-change.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@
12
12
# Basic example
13
13
14
14
```js
15
-
// globally imported `h`
16
-
import { h } from'vue'
15
+
// globally imported `createElement`
16
+
import { createElementash } from'vue'
17
17
18
18
exportdefault {
19
19
// adjusted render function arguments
@@ -30,7 +30,7 @@ export default {
30
30
31
31
# Motivation
32
32
33
-
In 2.x, VNodes are context-specific - which means every VNode created is bound to the component instance that created it (the "context"). This is because we need to support the following use cases:
33
+
In 2.x, VNodes are context-specific - which means every VNode created is bound to the component instance that created it (the "context"). This is because we need to support the following use cases (`h` is a conventional alias for `createElement`):
34
34
35
35
```js
36
36
// looking up a component based on a string ID
@@ -46,7 +46,7 @@ h('div', {
46
46
})
47
47
```
48
48
49
-
In order to look up locally/globally registered components and directives, we need to know the context component instance that "owns" the VNode. This is why in 2.x `h` is passed in as an argument, because the `h` passed into each render function is a curried version that is pre-bound to the context instance.
49
+
In order to look up locally/globally registered components and directives, we need to know the context component instance that "owns" the VNode. This is why in 2.x `h` is passed in as an argument, because the `h` passed into each render function is a curried version that is pre-bound to the context instance (as is `this.$createElement`).
50
50
51
51
This has created a number of inconveniences, for example when trying to extract part of the render logic into a separate function, `h` needs to be passed along:
52
52
@@ -95,12 +95,12 @@ In 3.x, we are moving towards a flat VNode data structure to address these probl
95
95
96
96
# Detailed design
97
97
98
-
## Globally imported `h` function
98
+
## Globally imported `createElement / h` function
99
99
100
-
`h` is now globally imported:
100
+
`createElement` is now globally imported (and can be renamed to `h` as before):
0 commit comments