As we know react works on virtual Dom, not real Dom. When state or props changed،،،،، this change is in the virtual Dom. Can we consider when the call setstate() method this change applies on the real Dom?
the setState will trigger a new render on the virtual DOM, which will use its diffing algorithm to check what has changed in the virtual DOM from the last snapshot to the current one.
After that, the virtual DOM will send a "package" with all the needed changes to make.
Finally, the real DOM will update the users' screen.