DEV Community

Discussion on: How do React Fragments work under the hood?

Collapse
 
fromaline profile image
Nick

May you provide a proof, please?
I ask, because these two things have nothing to do with each imo.
Also, DocumentFragment has no corresponding DOM element too.

Collapse
 
maksimrv profile image
Maksim

because these two things have nothing to do with each imo

Conception absolutely the same. I bet that React team when tried to create element which should solve the problem "No wrapper" they came to conecption which existed long time in DOM. You can create document fragment and manipulate it as regualr element, add child nodes, query etc. But when you append document fragment to a DOM tree it would "disappear" and parent node of document fragment would be parent node of document fragment's childern. The same you can see in React virtual tree where Fragment represent part of the virtual document. So my response was just to clarify a little bit a phrase from you article :) Becuse sometimes it's easy to clarify virtual DOM conceptions using "real" DOM

Some comments have been hidden by the post's author - find out more