|
|
|
|
|
by sraquo
2652 days ago
|
|
> Oh wow. You just described the existing imperative DOM APIs, haven't you? Inflexible implementation wasting everyone's time. Existing DOM APIs are very simple, low level and unopinionated. A pleasure to build libraries on. That's what durable platform APIs should look like. It is very easy to build virtual dom and importantly other DOM management paradigms on top of those low level APIs. The same can not be said about virtual dom - it's a very opinionated, very rigid paradigm. I know because I built FRP UI libraries based on Snabbdom and on native DOM APIs. The latter is much simpler to deal with and more performant. Virtual DOM only works well if that's exactly what you want. It has no place among browser APIs, at least not in any recognizeable shape or form. Regarding performance, the whole point of the virtual dom is that the diffing engine does not know which elements changed or didn't change. It gets a new virtual subtree and has to diff it with the previous one. The browser would be doing all the same diffing work, just closer to the metal. But we will soon be able to do the same with just WASM. |
|
I built something on native APIs and on userland APIs. Native APIs are more performant.
Really? That surprises you?
> The browser would be doing all the same diffing work, just closer to the metal.
Exactly my point