Chapter 6: An Introduction to JSX
by Matt Burnett
When React was first introduced, one of the features that caught most people's attention (and drew the most criticism) was JSX. If you're learning React, or have ever seen any code examples, you probably did a double-take at the syntax. What is this strange amalgamation of HTML and JavaScript? Is this even real code?
Let's take a look at what JSX actually is, how it works, and why the heck we'd want to be mixing HTML and JS in the first place!
What is JSX?
Defined by the React Docs as an "extension to JavaScript" or “syntax sugar for calling React.createElement(component, props, ...children))
”, JSX is what makes writing your React Components easy.
JSX is considered a domain-specific language ...
Get Your First Week With React now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.