Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean exactly that "React updates DOM dynamically"?

The ReactJS website states that,

When the data changes, React conceptually hits the "refresh" button, and knows to only update the changed parts.

What does this mean exactly?

How is this achieved?

How is this different from what AngularJS does?

like image 562
Lucia Avatar asked Feb 03 '26 15:02

Lucia


1 Answers

Reactjs create a virtual DOM and does not touch to the real DOM. Then when some of DOM changed, it will use diff algorithm to find out what is different from previous state of DOM elements, finally just replace that changes. You can see this link for that algorithm to have more understanding. And you have to know what is shadow DOM as well.

like image 97
thangchung Avatar answered Feb 06 '26 04:02

thangchung