Skip to main content

3.06.0 Jsx

JSX - is syntax lightweight to understand.

JSX design has two main goals: be the same as HTML for human eyes, and so that machines don't confuse it with HTML. Because HTML is compiled from JSX.

Check out what the same code looks in JSX and in pure React:

class App extends Component {
render() {
return (
<div className="shopping-list">
<h1>Shopping List for {this.props.name}</h1>
<ul>
<li>Instagram</li>
<li>WhatsApp</li>
<li>Oculus</li>
</ul>
</div>
)
}
}

Both Pure React and JSX are Javascript. But JSX was desinged to be more like HTML. To facilitate the layout process.

JSX looks like HTML. Pure React looks like Javascript. But this is it. And JSX is Javascript too.

This conversion from JSX to React make Babel.