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.
Related questions
0
votes
Q: Why fragments are better than container divs in ReactJS?Explain with Example?
asked
Oct 29, 2023
in
ReactJS
by
DavidAnderson
reactjs-interview-questions-answers
0
votes
Q: What are fragments?
asked
Jan 31, 2021
in
ReactJS
by
Robindeniel
#fragments-react
reactjs-fragments
fragments
0
votes
Q: Why is there a need for using keys in Lists?
asked
Feb 14, 2023
in
ReactJS
by
Robindeniel
reactjs
0
votes
Q: Why use React instead of other frameworks, like Angular?
asked
Feb 14, 2023
in
ReactJS
by
Robindeniel
reactjs
0
votes
Q: Why React uses className over class attribute?
asked
Jan 31, 2021
in
ReactJS
by
Robindeniel
#react-classname
class-attribute
reactjs
0
votes
Q: In which directory React Components are saved?
asked
Apr 14, 2021
in
ReactJS
by
SakshiSharma
react-js
reactjs
react-js-mcq
reactjs-mcq
reactmcq
0
votes
Q: What are React Mixins?
asked
Feb 24, 2021
in
ReactJS
by
SakshiSharma
#react-mixins
mixins
reactjs
0
votes
Q: What are error boundaries in React v16?
asked
Jan 31, 2021
in
ReactJS
by
Robindeniel
#error-boundaries
boundaries
reactjs
react-v16
0
votes
Q: What are the limitations of React?
asked
Jan 31, 2021
in
ReactJS
by
Robindeniel
#reactjs-limitations
reactjs
react-disadvantages
0
votes
Q: What are the advantages of React?
asked
Jan 31, 2021
in
ReactJS
by
Robindeniel
#reactjs-advantages
react-benefits
reactjs
...