August 2017
Beginner
374 pages
10h 41m
English
To be able to use JSX, we need to install the React plugin for Babel. It will then compile JSX into proper calls to the React API. Firstly, we need to install the babel-preset-react package:
npm install --save-dev babel-preset-react
In addition to installing the preset, we also need to tell Babel to use it. Edit .babelrc, find the "presets" property, and add "react" to the array. It should look like this now:
{
"presets":[ "es2015", "react" ],
"plugins": [ "transform-object-rest-spread" ]
}
Read now
Unlock full access