Ch-2 JSX/ES6

Ch-2 JSX/ES6

Table of contents

While surfing around the internet about react, everyone would have come across the terms like JSX, ES5, ES6 etc. These opaque acronyms can be a little confusing.

ES5(where ES stands for ECMAScript) is basically "regular JavaScript", where the numeric value stands for n^th update.

ES6 is a new version of JavaScript that adds some nice syntactical and functional additions.

Render

All React components have a render function that specifies what the HTML output of our React component will be. JSX is a React eXtension that allows us to write JavaScript code that looks like HTML.

The following code uses a React component that renders an h1 HTML tag. JSX allows us to declare this element in a manner that closely resembles HTML.

The render( ) function in the HelloWorld component looks like it's returning HTML, but this is actually JSX. The JSX is translated to regular JavaScript at runtime.