Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Why fragments are better than container divs?
Home
ReactJS
Why fragments are better than container divs?
0
votes
asked
Jan 31, 2021
in
ReactJS
by
Robindeniel
Why fragments are better than container divs?
#fragments-react
reactjs
reactjs-container
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 31, 2021
by
Robindeniel
Below are the list of reasons,
Fragments are a bit faster and use less memory by not creating an extra DOM node. This only has a real benefit on very large and deep trees.
Some CSS mechanisms like Flexbox and CSS Grid have a special parent-child relationships, and adding divs in the middle makes it hard to keep the desired layout.
The DOM Inspector is less cluttered.
...