October 2017
Intermediate to advanced
302 pages
7h 27m
English
Let’s open up our src/index.js and see how we can spice it up.
First, we can replace our require calls with the new import syntax. It looks like this:
import React from ‘react’;import ReactDOM from 'react-dom';
It's a little cleaner, and it lets us do some cool stuff, which we’ll see later.
Do that for both React and ReactDOM, and then we can finally replace our React.createElement call.
As you may guess, it would be very unwieldy to build a complex UI by calling React.createElement for every HTML element we need. We want the power and functionality of JavaScript, but with the readability of HTML.
Enter JSX; JSX is a type of syntax that looks like HTML, but is actually JavaScript underneath. In other words, it compiles down ...
Read now
Unlock full access