3 ms·
From the conclusion: > Virtual DOM is valuable because it allows you to build apps without thinking about state transitions, with performance that is generally
by guscost 7y ago
From the conclusion:
> Virtual DOM is valuable because it allows you to build apps without thinking about state transitions, with performance that is generally good enough.
In other words, Virtual DOM is somewhat-valuable overhead. This is a cool alternative, seemingly sort of a compile-time version of Knockout. It's probably worth a try for writing an efficient client app, but I have a hunch that I'd miss the "HTML-in-JS(X)" pattern if I went back to using "JS(?)-in-HTML" instead. A VDOM runtime allows you to write plain JS that "just works", at least until certain parts need to run faster. This means junior programmers can pick it up and become productive quickly, and avoid driving their projects off a metaphorical cliff.
Of course this is bought with bandwidth and CPU overhead, lots of it in some cases. The call you should make when considering a VDOM is whether the safety and familiarity benefits are worth the overhead. If your team is experienced enough to take on a new DSL for rendering markup (which every template-binding tool really is) and meticulous enough to assign instead of mutate and avoid two-way binding pitfalls, go for it. If not, be careful.
This is not meant as a challenge. Personally I wouldn't want to work on a big application that is wholesale optimized in this way, unless there was no alternative. I wouldn't write my own game engine (if it was for a job) either.
- floatboth 7y agoYou can easily do HTML-in-JS "react-like" rendering without diffing! lit does just that https://lit-element.polymer-project.org https://lit-element.polymer-project.org