News for hackers. Stuff that matters.
Re:Snabbdom – A Simple, Modular, Powerful, and Fast Virtual ... by wrong_variable on Saturday July 16, 2016 @05:56PM (#12108033)
easy, using vanilla.js !

you attach event-handlers to each virtual-dom the same way you would do with a normal-dom.

and those event-handlers can react to change the way you want.

If you mean how to do auto-data binding

oldDom = patch (document.body,newDom)

newDom = h ('div','hello world')

patch (oldDom,newDom)

patch is the function that does the dom diffing.

The amazing thing is most web components do not need auto-diffing.

Sometimes you want fine grained control where you write your own update functions - making imperative changes to the dom based on your needs.

And for other web components where you want more auto-updates you can patch accordingly.

The thing that is amazing is that you can dial it up and down based on your individual needs.

A good example is table components with a lot of data.

You really do not want to incrementally update the table.

So for the divs with the data you patch

but other components that have a lot of interactivity you can simply not patch and do updates by hand.

There are no comments on this comment yet.