From the course: Building Modern Projects with React

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Supporting ES6

Supporting ES6

From the course: Building Modern Projects with React

Start my 1-month free trial

Supporting ES6

- [Instructor] So we're going to be writing our React code using ES6 syntax and we're also going to need to add support for JSX, React's special HTML-like syntax for defining page layouts. And in order to do all this, we're going to start off by opening up a terminal inside our directory and running npm install --save-dev @babel/core @babel/cli @babel/preset-env and @babel/preset-react. And then we're going to hit enter. And that might take a little while to run. But once it does, the next thing we need to do is create a .babelrc file. This file will tell the Babel transpiler what presets and plugins to use to transpile our code. So let's create this .babelrc file in the root of our directory. Call it .babelrc. Don't forget the dot before it. And inside this file, we're going to define a JSON object. And this object will have a property presets that will be an array of two strings. The first one's going to be…

Contents