DEV Community

Discussion on: Class Contradictions in TypeScript vs JavaScript

Collapse
 
nickytonline profile image
Nick Taylor

I don't think you need to start cranking out classes if you're using TypeScript (TS). Maybe you're referring to Angular code? I've written a lot of React in TS and just plain TS and rarely used classes.

Classes are not inherently bad, it's just that functional programming has become more popular these days.

Collapse
 
itsjzt profile image
Saurabh Sharma

After hooks, classes are rarely

Collapse
 
bytebodger profile image
Adam Nathaniel Davis

I agree. And that's why I said that you don't have to use classes - especially with React Hooks. But what I'm trying to allude to in the article (and perhaps I didn't do a good job of it) is what I perceive as the general attitude of React/JS devs vs. TS devs. As with the friend that I described at the end of the article, I know some "JS guys" who hate classes. And yet, when those same guys switch over to TS, their class hatred seemingly melts away...

Thread Thread
 
itsjzt profile image
Saurabh Sharma

Yeah I agree. In typescript people are more likely to uses classed compared to js.