Babel
Babel is a transpiler for Javascript. Essentially, it takes source code in one form and transforms it into another. Let’s install it in our project.
|
|
For our app, Babel will be taking our source code and converting it to ES5. To do this, we’ll need to add a .babelrc
to the root of our project.
|
|
Here we’re using the transform-runtime
plugin which has various conveniences which you can read up on here.
The presets allows us to use the following:
ECMAScript 2015
ES2015 is the latest version of ECMAScript which introduced new syntax such as import
, const
, let
and arrow functions.
|
|
ECMAScript Stage 3 Candidate Features
ECMAScript feature requests go through the TC39 process. Stage 3 features are essentially candidates for the next version, waiting for feedback before being finalised. They are usually safe to use.
|
|
JSX
JSX is XML in Javascript. This is useful for writing your React components like HTML elements instead of nested functions, making it more intuitive.
|
|
Conclusion
You should now have a project directory which looks something like:
|
|