Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
69
rated 0 times [  76] [ 7]  / answers: 1 / hits: 94930  / 10 Years ago, sun, february 23, 2014, 12:00:00

Recently, I looked at Facebook's React framework. It uses a concept called the Virtual DOM, which I didn't really understand.



What is the Virtual DOM? What are the advantages?


More From » reactjs

 Answers
7

React creates a tree of custom objects representing a part of the DOM. For example, instead of creating an actual DIV element containing a UL element, it creates a React.div object that contains a React.ul object. It can manipulate these objects very quickly without actually touching the real DOM or going through the DOM API. Then, when it renders a component, it uses this virtual DOM to figure out what it needs to do with the real DOM to get the two trees to match.



You can think of the virtual DOM like a blueprint. It contains all the details needed to construct the DOM, but because it doesn't require all the heavyweight parts that go into a real DOM, it can be created and changed much more easily.


[#72364] Friday, February 21, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jakobarmandr

Total Points: 363
Total Questions: 103
Total Answers: 87

Location: Romania
Member since Mon, Jun 6, 2022
2 Years ago
jakobarmandr questions
Thu, May 13, 21, 00:00, 3 Years ago
Thu, Aug 20, 20, 00:00, 4 Years ago
Thu, Jan 2, 20, 00:00, 4 Years ago
Mon, May 13, 19, 00:00, 5 Years ago
;