Capítulo 13 de 116
JSX exists because rendering logic and markup are inherently coupled — React keeps them together in one component instead of splitting them across separate HTML/JS files, but JSX itself is stricter than HTML and has three concrete rules for converting existing HTML.
<div>, or use an empty Fragment <>...</> when you don't want an extra DOM node. Under the hood JSX becomes plain JS objects, and a function can't return two objects unwrapped — that's the real reason for this rule.<img />, not <img>); wrapping tags need an explicit close (<li>item</li>).stroke-width → strokeWidth, class → className (matching the DOM's own className property). Exception: aria-* and data-* keep their dashes for historical reasons.<>
<img src="..." alt="Hedy Lamarr" className="photo" />
<ul>
<li>Invent new traffic lights</li>
</ul>
</>
<img />, and className instead of class.<div> when you want the extra node in the DOM, a Fragment (<>...</>) when you don't.className), not a style preference — get it wrong and React logs a console suggestion, but it won't silently work like HTML would.<>...</> shorthand.