3 ms·
Sure, but this is being addressed in: https://github.com/tc39/proposal-class-fields https://github.com/tc39/proposal-class-fields And available now as: https:/
by gedy 8y ago
Sure, but this is being addressed in: https://github.com/tc39/proposal-class-fields https://github.com/tc39/proposal-class-fields
And available now as:
https://babeljs.io/docs/en/babel-plugin-proposal-class-properties https://babeljs.io/docs/en/babel-plugin-proposal-class-prope...
- dmitriid 8y agoNo, it's not addressed. And you can see me using class fields already in `x = () => ...` <- this is a class field (I called it class property, sorry). The fact that arrow functions declared as class fields get access to the proper `this` in the class instance is just a happy(?) coincidence with its own downsides. For example, class fields can't be inherited in the child class. So this adds a yet another layer of confusion for devs. And as you see in the example at the link you provided, you still need to `.bind(this)` the actual methods.