Hacker News new | ask | show | jobs
by boubiyeah 3360 days ago
ES6 classes are a complete mess brought by corporate people loving OO, even in a setting that doesn't make sense.

You can "autobind" with this notation:

myMethod = () => {

}

but it doesn't look as good as myMethod() {} and you have to remember this EVERY TIME you add a method.

Also, you never need to use the constructor in React. Just do: state = {} in the body of the class. You may need babel presets #918718$$&ééàdi for it to work though.

1 comments

Classes and inheritance are features of type systems, not OOP. Plenty of functional programming JS libraries use classes for testing types (for example, the Either monads' Left and Right).
Classes and class inheritance are features of class-based systems, yes.

Prototypes and prototype inheritance are features of prototype based systems.