> Right away, you'll notice a subtle difference – a more terse syntax is available to you when defining classes:
// The ES5 way
var Photo = React.createClass({
handleDoubleTap(e) { … },
render() { … },
});
// The ES6+ way
class Photo extends React.Component {
handleDoubleTap(e) { … }
render() { … }
}
It may or may not be more terse in longer examples, but ES6 already supports things to make the class syntax less terse here by about the same margin the article claims.
While it doesn't add up to a terribly large amount of extra characters, you are missing the function keyword (ie. `handleDoubleTap: function(e)`) in the ES5 example.
> Right away, you'll notice a subtle difference – a more terse syntax is available to you when defining classes:
It may or may not be more terse in longer examples, but ES6 already supports things to make the class syntax less terse here by about the same margin the article claims.