React creates elements for itself using its createsElements () function. By combining all the elements, he creates a separate dom inside himself. This dom is called Virtual Dom. React's virtual dom basically renders as much as the browser's dom has changed.
We can imagine the Virtual Dom as a simple tree. The different notes of which are one component. Whenever we change the state of a component, a tree is created first. Where the modified component and its child components are reconstructed. That is, React has two representations of the virtual dom. One is the state before it, and the other is the state after the change. React compares these two conditions.
React uses the "Diff" algorithm to do this comparison. With that, React can understand which places have changed. React then changes only the part of the dom where the change was made.
Attempts have been made to simply explain the virtual DOM and diffing-algorithm without any explanation.
Reach out to me on: