Why fragments are better than container divs?

Technology CommunityCategory: ReactWhy fragments are better than container divs?
VietMX Staff asked 3 years ago

Below are the reasons why fragments recommended 1. Fragments bit faster and has less memory usage by without creating an extra DOM node. This only has a real benefit on very large and deep trees. 2. Some CSS mechanisms like Flexbox and CSS Grid have a special parent-child relationship, and adding divs in the middle makes it hard to keep the desired layout. 3. The DOM inspector is less cluttered