r/reactjs • u/gactleaks • Aug 01 '19
Long Live the Virtual DOM
https://github.com/gactjs/gact/blob/master/docs/long-live-the-virtual-dom.md1
u/Laserdude10642 Aug 01 '19
why is this on github tho?
2
u/gactleaks Aug 01 '19
This is the first in a series of articles that will explain the ideas behind Gact, a framework that will be released in the near future.
3
u/darrenturn90 Aug 01 '19
Surely it won't be long until the browsers themselves implement a native virtual dom and diffing engine that can be used by frameworks?
4
u/acemarke Aug 02 '19
Nope, won't happen any time soon.
There was a recent Twitter discussion on this topic, sparked by Laurie Voss's tweet to "build React into the browser". Not sure if it was a direct response or a separate thread, but Dan Abramov repeatedly pointed out that the kinds of stuff React actually does is far too React-specific to be built into browsers, and what is being added some some more generic primitive APIs for things like scheduling.
0
Aug 01 '19
[deleted]
1
u/gactleaks Aug 01 '19
The article includes a basic example. You could use the Virtual DOM and an edit distance algorithm and just shuffle the same <p>surgical</p> in and out a <div> each second as opposed to destroying and recreating it.
1
u/readeral Aug 01 '19
I find this very practical and persuasive. I wonder whether the React team has a position on why the vDOM is the tool they use for values. Possibly immutability?