JSX is the bridge between logic and layout. It's the standard way we describe UI in React, combining the familiarity of HTML with the power of full JavaScript expressions.
1The Compilation Engine
JSX isn't a string and it's not HTML. It's a syntactic sugar that Babel compiles into React.createElement() objects. This abstraction allows React to maintain a Virtual DOM efficiently. Every tag you write becomes a JavaScript object that React uses to track state and changes.
2The Reserved Word Protocol
Because JSX is compiled into JavaScript, we must respect JS reserved words.
- →className: Replaces the standard 'class' attribute.
- →htmlFor: Replaces the 'for' attribute used in labels.
- →camelCase: All standard HTML attributes like
tabindexoronclickbecometabIndexandonClick.
