What is a fragment and why would you use it?
Model answer
A fragment lets a component return several elements without adding an extra wrapper node to the DOM. The short form is <>...</>. When you need to give it a key, for example in a list, use <Fragment key={id}>.
It keeps the HTML clean and avoids invalid structures, such as a div inside a table row.
Learn this topic
React Components and Props Explained with Examples in the course React.js Full Course: Beginner to Advanced.
Sign in to add your own answer.