2 ms·
I find classes in JavaScript just more tedious, and they’re really just syntactical sugar on top of a function anyways. Working in react I’m always making thing
by sethc2 6y ago
I find classes in JavaScript just more tedious, and they’re really just syntactical sugar on top of a function anyways.
Working in react I’m always making things immutable, and I generally use typescript, and classes to me are just more painful to write then a function whose parameters act effectively as constructor arguments and the return statement which is the classes public API.
- sethc2 6y agoI should say though, I will use classes if I’m trying to do OOP, and using a lot of inheritance. I find it easier for me to make “clean” in those cases, then doing the equivalent with functions, but that might just be old habits from when I only OOP