React JSX Basics
JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file.
The Rules of JSX
JSX is stricter than HTML. You must return a single root element (like a <div> or a <>Fragment</>). You also must explicitly close all tags, even those that don't have closing tags in regular HTML, like <img />.
camelCase Attributes
JSX turns into JavaScript, and attributes written in JSX become keys of JavaScript objects. Since variables can't contain dashes, attributes like stroke-width become strokeWidth, and class becomes className.
JavaScript inside JSX
You can pass any JavaScript expression (like strings, variables, or functions) as dynamic values inside JSX by wrapping them in curly braces { }. This is how React makes UIs dynamic.
View Full Transcript+
This section contains the full detailed transcript of the video lessons. It covers how JSX transforms into `React.createElement` calls, why fragments are important to avoid DOM bloat, and the strictness of XML-like syntax.
