DEV Community

Discussion on: Don’t excessively mutate the DOM. Here’s what you should do instead.

Collapse
 
bbarbour profile image
Brian Barbour

Nice! I had no idea about createDocumentFragment.

Is this the same as the empty <> </> tag or fragments in React?

Collapse
 
marko035 profile image
Marko

Well its the same thing actually, except one small difference. You could get same performance if you appended everything to some div (defined outside of loop) and then after the loop, append that div the the element you want. Only difference is that when you append fragment you wont have element holder (div in this case) after appending.