Skip to content

A simple basic implement of virtual-dom algorithm

Notifications You must be signed in to change notification settings

fantasticit/vdom

Repository files navigation

vdom

A simple basic implement of virtual-dom algorithm

文章说明:vdom 原理解析与简单实现

实际应用:qcharts

Usage

let node1 = (
  <div>
    <ul>
      {[1, 2, 3].map(i => (
        <li>{i}</li>
      ))}
    </ul>
  </div>
)

let node2 = (
  <div className="test">
    <ul>
      {[...Array(1000).keys()].map(i => (
        <li>{i}</li>
      ))}
    </ul>
  </div>
)

render(node1, '#app')

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

vdom-gif

LICENSE

MIT

About

A simple basic implement of virtual-dom algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published