Hacker News new | ask | show | jobs
by mudetroit 3472 days ago
He may have chosen to use newer syntax, but the same pattern can be used without computed keys with only a tiny more code:

  var stateUpdate = {}
  stateUpdate[event.target.name] = event.target.value;
  this.setState=(stateUpdate);
I don't think there was anything necessarily wrong with his tone as he was addressing the tone of the original article.
2 comments

Telling someone, "or maybe you should learn JavaScript" is kind a really jerky way of saying, "you don't know what you're doing". I do think it was a terrible way to share knowledge. Yet it was an excellent way to say, "I know more than you".
I agree it is rather combative, however it's also true. To claim that X pattern is a reason to not use a library when said pattern is actually an anti-pattern you've used because of lack of understanding is going to garner these kinds of reactions.
This is exactly what I've been using for a while now, and was hoping something better already existed in ES6. Great to know there is!

FWIW, this is supported in the newest Chrome as well.