Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C'mon.

> 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.


Ah, now I think I understand what they were trying to argue—full ES5 versus ES6 where I took it to be ES6 versus ES6-using-class.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: