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
## Replacing Template Features with Plain JavaScript
213
+
214
+
Wherever something can be easily accomplished in plain JavaScript, Vue render functions do not provide a propriety alternative. For example, in a template using `v-if` and `v-for`:
215
+
216
+
```html
217
+
<div>
218
+
<ulv-if="items.length">
219
+
<liv-for="item in items">{{ item.name }}</li>
220
+
</ul>
221
+
<pv-else>No items found.</p>
222
+
</div>
223
+
```
224
+
225
+
This could be rewritten with JavaScript's `if-else` and `map` in a render function:
As mentioned above, components with children must use a thunk: i.e. a function that returns an array of children, rather than the array of children directly. This delays children creation until the component itself is rendered, allowing more efficient re-renders.
0 commit comments