Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Snabbdom – A Simple, Modular, Powerful, and Fast Virtual DOM Library. Parent comment
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.
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.