Skip to content

Instantly share code, notes, and snippets.

@wolframkriesing
wolframkriesing / agenda.md
Last active August 1, 2016 20:12
ES6 + React.js workshop

[Sign up for July 6+7th here][signup]
Trainer: [@WolframKriesing], uxebu
Location: Munich, Germany

Goal of the workshop

Create and deploy a web application integrating the latest features of the upcoming JavaScript version ECMAScript6 (ES6) and test-driven development (TDD) in your workflow from the beginning and deploying a real app.

  • deploy continuously
  • go small steps
  • iterate fast
arr.map(val => val * 2)
arr.map(function(val) { return val * 2 })
// ES5
var self = this;
doAsync(function(result) { self.onDone(result); })
// ES6
doAsync((result) => {this.onDone(result)})
// also valid without parens, for one parameter
doAsync(result => {this.onDone(result)})
// ES5
arr.map((function(){return this.process()}).bind(this))
beforeEach(function() {
this.testMe = false;
});
it('testMe must be false', () => {
assert.equal(this.testMe, false); // fails
});
it('testMe must be false', function() {
assert.equal(this.testMe, false); // passes
});
const isThree = num => num === 3;
const containsThree = arr => !!arr.find(item => item === 3);

ECMAScript 6 has classes built-in. It is a shorter notation for the well-known prototype approach.

class Kata {
  constructor(name) {
    // initialize instance properties in the constructor
    this.name = name;
  }
  // instance method
var sinon = require('sinon');
beforeEach(function() {
this.sinon = sinon.sandbox.create();
});
afterEach(function(){
this.sinon.restore();
});
import {Some} from './some'
var assert = require('assert');
describe('something', () => {
it('that should work', () => {
assert.equal(new Some().method(), 'works');
});
});