I have been using React for a while now, and I have become comfortable with the concept that I must manually bind my component methods to my component instance, as React made th
The reason why React keeps mentioning autobinding is because React.createClass was autobinding all methods. And that method was the only way to create components.
People, especially those not that familiar with JavaScript, got used to passing methods to other components and this
would "magically" work. This feature disappeared with using native ES6 classes, so they needed to emphasize the difference.
But yes, ES6 classes are basically just syntactic sugar for constructor functions + prototype. The methods are not bound to the object:
class Foo {
bar() {}
}
const foo = new Foo();
console.log(foo.hasOwnProperty('bar')); // false
console.log(typeof Foo === 'function'); // true
console.log(Foo.prototype.hasOwnProperty('bar')); // true