Q13: What is React.Fragment and why is it useful?
React.Fragment (or <>...</>) allows grouping a list of children elements without adding extra wrapper nodes (like <div>) to the real DOM, keeping DOM layout trees clean.
Key Takeaways
- Groups child elements without adding unnecessary DOM wrapper nodes.
- Can accept
keyprops when using full<React.Fragment key={id}>syntax.
Knowledge Check
What is the primary benefit of using React.Fragment over a standard div wrapper?