Re:Common mistakes writing React components with hooks
by fendy3002 on Tuesday July 21, 2020 @07:09PM
(#23911897)
That's not without reason, javascript class is infamous for being weird with 'this' gotchas, and class is 2nd class citizen there (not as good / powerful as one in java). Meanwhile function based view is neat.
However without hooks, only class based component has side effects and lifecycle, so you like it, then made switch to hooks because it's neat.
During this time, I started playing around with React and I thought, I learned my lesson, it's class-based components all the way. Yet again, the community started going to "other" way with function-based components and I was steadfast in my attachment to classes - refusing to budge.
Of course, I eventually made the switch and wish I had done so sooner. Once you get the hang of hooks, they're so much easier to reason about and, as you said, make me much more productive.