Welcome to part two of ECMAScript 6: Why Should I use it? If you missed part one, you can find it here. This time, we’ll be looking at the following features that ECMAScript 6 brings to the developer:
What is ECMAScript 6?
As if that wasn’t enough reason to start learning about ECMAScript 6, over the next few posts, I’ll introduce you to some of the most useful features that you should start looking into right now!
Today, we are going to build a Wikipedia viewer using React and Webpack in tandem. If you are not familiar with React at all, I recommend that you go through the introductory material first, it’ll save you a headache!
Additionally, we are going to be using ES6 class syntax for creating components, as this is the way React is heading towards. The previous tutorial in this series goes into more detail, so go ahead and take a look if you’d like. Let’s get our hands dirty then…
January 16th, 2018 Update
As certain sections of this guide are now obsolete, here’s an updated solution proposed by avid reader Goungaf Saâd.
You can take a look at this version in this GitHub repo. Note that he is using create-react-app on this project, so the overall set-up might be slightly different.
This time around, we are going to build our lovely local weather app using React, Webpack and Babel. These 3 tools in conjunction give as enormous power and awesome syntactic sugar for our code.
We’ll make use of ECMAScript 6 classes, promises and arrow functions among others, but first, we need to get a proper environment set up. Navigate to your project folder and run the following command:
Note: If you don’t have Node and NPM installed, take a quick look at this post, that will get you going.
You’ll be asked for a few things, such as app name, author, description etc. Feel free to take your time and fill them in properly, or anxiously press enter to skip everything. Once done, you’ll have a package.json file in your project directory.
We’ll be building a weather app this time around; this project will serve as a nice introduction to a language that has been embraced by Angular 2, and can prove to be tremendously powerful: TypeScript.
stay tuned, a ReactJS + JSX version of this tutorial will come along shortly can be found here.