Capítulo 67 de 116
<Fragment> (usually written as the shorthand <>...</>) groups multiple JSX children without adding an extra node to the rendered DOM — the formal API behind the "single root element" rule from Ch 13.
<>...</> for the common case, and the explicit <Fragment>...</Fragment> for the one situation the shorthand can't handle — passing a key.key on a Fragment: when rendering a list (Ch 17) where each item needs to return multiple sibling elements (not just one), the explicit <Fragment key={id}> form is required, since the shorthand syntax has no way to accept props.<div>, a Fragment leaves zero trace in the rendered HTML — useful when an extra wrapper element would break CSS (e.g. flex/grid layouts that depend on direct-child selectors) or semantic HTML structure (e.g. <tr> needing <td> as direct children, not a wrapping <div>).key, and has no rendering behavior of its own beyond passing its children through.function Row({ item }) {
return (
<Fragment key={item.id}>
<td>{item.name}</td>
<td>{item.value}</td>
</Fragment>
);
}
Fragment form with a key, needed because this list item returns two sibling <td>s — the shorthand <> couldn't carry the key prop here.<>...</> shorthand; reach for the explicit <Fragment> form only when a key is needed (multi-element list items).Fragment + key form.