An open API service indexing awesome lists of open source software.

https://github.com/fantasticit/vdom

A simple basic implement of virtual-dom algorithm
https://github.com/fantasticit/vdom

Last synced: 3 months ago
JSON representation

A simple basic implement of virtual-dom algorithm

Awesome Lists containing this project

README

          

# vdom

> A simple basic implement of virtual-dom algorithm

文章说明:[vdom 原理解析与简单实现](https://github.com/justemit/coding-note/issues/23)

实际应用:[qcharts](https://github.com/spritejs/q-charts)

## Usage

```javascript
let node1 = (



    {[1, 2, 3].map(i => (
  • {i}

  • ))}


)

let node2 = (



    {[...Array(1000).keys()].map(i => (
  • {i}

  • ))}


)

render(node1, '#app')

document.querySelector('.btn').onclick = () => {
const patches = diff(node1, node2)
patch('#app', patches)
}
```

![vdom-gif](https://user-images.githubusercontent.com/26452939/49984490-41978000-ffa3-11e8-9112-9d20e606013f.gif)

## LICENSE

MIT