# Virtual DOM 2
##### [source : https://jsfiddle.net/softm/cgqnzewm/](https://jsfiddle.net/softm/cgqnzewm/)
```html
```
```javascript
/** @jsx h */
function h(type, props, ...children) {
return { type, props, children };
}
function createElement(node) {
if (typeof node === 'string') {
return document.createTextNode(node);
}
const $el = document.createElement(node.type);
node.children
.map(createElement)
.forEach($el.appendChild.bind($el));
return $el;
}
const a = (
- item 1
- item 2
'web > javascript' 카테고리의 다른 글
Write your Virtual DOM 2: Props & Events (0) | 2019.07.12 |
---|---|
Virtual DOM 3 (0) | 2019.07.12 |
Virtual DOM 1 (0) | 2019.07.12 |
Javascript Prototype to json (0) | 2019.07.12 |
Javascript Promise(프로미스는) (0) | 2019.07.12 |
댓글