setState method and the framework checks if the state or props have changed and re-renders a component on UI.
React’s docs provide a good high-level overview of the mechanism: the role of React elements, lifecycle methods and the
render method, and the diffing algorithm applied to a component’s children. The tree of immutable React elements returned from the
render method is commonly known as the “virtual DOM”. That term helped explain React to people early on, but it also caused confusion and isn’t used in the React documentation anymore. In this article I’ll stick to calling it a tree of React elements.
Besides the tree of React elements, the framework has always had a tree of internal instances (components, DOM nodes etc.) used to keep the state. Starting from version 16, React rolled out a new implementation of that internal instances tree and the algorithm that manages it code-named Fiber. To learn about the advantages which the Fiber architecture brings check out The how and why on React’s usage of linked list in Fiber.