Setting up React for ES6 ES2015 with Webpack and Babel

This resource came in quite handy when setting up React in combination with ES6 ES2015, Webpack and Babel. Installing all the required dependencies: # Install Webpack npm install –save-dev webpack # Install the Babel Loader, for use with Webpack npm install –save-dev babel-loader # Install the es2015 and react presets, for use with Babel npm …

ES6 ES2015 Arrow Functions and this

Why you’d want to use arrow functions (next to them being shorter to type): Arrow functions will maintain the this value of the enclosing context Yes, this will work just fine: function Wilto() { this.age = 32; setInterval(() => { this.age++; console.log( “I am now ” + this.age + ” years old”); }, 3000 ); …