3 ms·
Thank you for fixing the misleading information from this article. I would add: 1."now you have to create 10 functions to get input from 10 inputs". Or you c
by ggregoire 10y ago
Thank you for fixing the misleading information from this article.
I would add:
1."now you have to create 10 functions to get input from 10 inputs".
Or you can learn JavaScript:
handleChange(event) {
this.setState({ [event.target.name]: event.target.value })
}
2. "Redux sounds like a synonym of verbosity, as well."
Nobody forces you to use Redux.
https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367#.bw11ampib https://medium.com/@dan_abramov/you-might-not-need-redux-be4...
- akhilcacharya 10y ago> [event.target.name]: event.target.value Dumb question but I've never seen this syntax before. What does it do or what is it called? (The brackets)
- prodigal_erik 10y agoComputed property names. Any expression whose value can convert to a string or symbol will work. ES6 added them: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- akhilcacharya 10y agoExcellent, thanks!
- nobleach 10y agoIt's not a dumb question at all. It's relatively new, and I would implore the originator of that comment to take a different tone. It requires a newer browser or some sort of transpilation step. (You're probably already using one if you're using React) Most of the React community has forged forward with ES6/ES2015, so learning that is definitely a part of the process.
- mudetroit 10y agoHe 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.
- akhilcacharya 10y agoThis 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.
- nobleach 10y agoTelling 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".
- moo360 10y agoI 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.
- deleted 10y ago[deleted]