3 ms·
"no need to bind methods", that's true but just letting you know its not a thing if you use es6 arrow functions. class SomeClass extends React { someMethod
by sebringj 9y ago
"no need to bind methods", that's true but just letting you know its not a thing if you use es6 arrow functions.
class SomeClass extends React {
someMethod = () => {
// already bound
}
}
- acemarke 9y agoTo be clear, that's not just an ES6 arrow function. That example relies on the Stage 2 Class Properties syntax, which currently requires a Babel plugin. Now, the React team does recommend using that syntax as a viable option, but it's not yet implemented in browsers, and _might_ still change down the road.
- sebringj 9y agointeresting point. that reminds me of the "..." syntax on object properties that isn't supported on es6 for objects but still is a pretty sweet feature.
- acemarke 9y agoThat one's a lot closer to being finalized. Object Rest/Spread is currently at Stage 3, and is already implemented in Chrome/V8. For reference on proposal status and details, see https://github.com/tc39/proposals https://github.com/tc39/proposals .