1

I am new to react, please bear with me :) i have read some documentation about the virtual dom and real dom, but i am still not getting the concept of virtual dom. so far i have got the idea is that (correct me if it's wrong), so a component's render method will return some markup, since the virtual dom will make change faster so everything rendered will be in the virtual dom, and these rendered elements will transformed into element HTML and stored in the real dom and finally displayed on the screen.

also i am little confused about the react structure, there is no actually html page, its all about bunch of components connected to each other and the render function inside the component. I know what being rendered will appears to the screen, but i am still can't get my head around with all the component concept connected with virtual dom and real dom. can someone give me a hand?

ssc-hrep3
  • 15,024
  • 7
  • 48
  • 87
Jonas Lu
  • 181
  • 1
  • 12
  • You don't have to bother about the Virtual DOM when using React. You just need to know that you have a render function which defines the layout of a component. This component is depending on the data. When the data changes, the HTML representation changes. Under the hood, React uses a Virtual DOM to make this change very fast. You can think of a component as a small HTML piece which is depending on the data and can contain other components (e.g. a button can contain a special icon which is also a component. The icon component is depending on its state to show a different icon). – ssc-hrep3 Dec 22 '19 at 00:08

0 Answers0