An interview guide for DOM, Document fragments, Virtual DOM, React fragments, Incremental DOM, and Shadow DOM. Let’s take a look at Virtual DOM Derived From Document Fragments.
The virtual DOM is a core concept of React. It’s a representation of the UI that’s kept in memory and synced with the actual DOM. The React DOM maintains the virtual DOM by reconciling the differences locally. The changes are inserted into the actual DOM based on the React pulling schedule.
DocumentFragment is an interface that defines the minimal document object without a parent. It’s used as a lightweight version of
Document and stores DOM objects. Document fragments have no effect on the actual DOM. But their children can be added to the actual DOM on demand.
The virtual DOM and document fragments use the same concept to improve the UI performance. Is the virtual DOM derived from document fragments?