Sep 1, 2018 · 1 min read
I see no good reasons to use classes in JS, unless you really need inheritance. And even if you do, thinking about ways to achieve your goal with composition instead of inheritance will most likely be more optimal. This is a typical mistake of people, who can’t switch their mindset from some other languages when writing JS. JS allows you to have kinda “instance without a class” — an object, which can combine both data and methods. This is a very powerful feature and refactoring to classes is ignoring it. And the provided example with trivial client side operations is definitely not a good use case for classes, it’s a suboptimal approach here.
