r/reactjs • u/blnkslt • Jan 16 '22
Discussion Should I still use class based components?
I'm returning to react after a long time to refresh my rusty skills in order to start building a quite big project. So I started to follow my good old udemy course which is made at 16.8 era when hooks were new stuff. Not surprisingly the tutorial is focuses on class based programming and discusses hooks as an addendum. On the other hand I see that the new react projects are mostly made of functional components with hooks. So it seems to me that class based and lifecycle hooks are all but history. I'm wondering whether learning class-based react a waste of time? If so where can I find good tutorials which focuses on new hooky way of coding in react?
View all comments
Show parent comment
1
u/That_Kaleidoscope_23 Apr 18 '24
Using JS , you can create classes by using functions , no need the class keyword. Whenever I see some react project made mostly by uisng functional components, I generally see a lot of copy-paste repetitive code, and it is very hard to debug. It is hard to debug , because developers create a lot more classes using those functions , but those classes only hidden in the code . If that was a class component based project , developers tend to think before creating a class. Also , I think it's harder to debug a buggy project when the code is not well organized ,compared to a code where coder spent time thinking rather than finishing it fast as possible with lots of bugs.