Hacker News new | ask | show | jobs
by Sankozi 35 days ago
Hooks made simple things simpler, but hard things harder, code with lots of boilerplate was replaced with code with leaky abstractions full of various workarounds - I don't think this is a good trade.

While I hate class component lifecycle methods they are much better than complex hook setups when solving more advanced problems.

2 comments

Could you elaborate why you dislike lifecycle methods? I read this take a lot and I use mainly angular but did some smaller projects with react class components and with function components. I also think function components are very counter intuitive but I also never had anything against lifecycle methods.
They often require quite complex ifology for simple use cases. Also didmount and diduptade often needs to be overriden together only to have almost the same implementation. They also have some gotchas regarding state updating inside them.
Just having an interval inside a component used to be trivial, but with hooks becomes tedious. Only the barebones simple ultra basic stuff became simple. Everything else? Harder.