Hacker News new | ask | show | jobs
by ljm 2017 days ago
The problem I see with hooks is how they replace one set of problems with another, and demand you structure your code in a way to avoid those pitfalls. You know, how to structure conditional code, how to use loops when dealing with hooks, having to think about function object equality, having to supply the functions and variables your callback/effect closes over as dependencies (I still don't understand why you would do some of that in favour of pulling your callback out of the component)... and for what? For it all to change in another year or so when the JS community starts hankering for another paradigm?

Lately when working with all this I feel as if the same code would be simpler and easier to follow if it wasn't shoehorned into JS. It's like the uncanny valley of functional programming.

But more fundamentally, dealing with frontend application code is mentally exhausting in a way I haven't experienced before. I feel like I'm no longer learning Javascript as a language, but just keeping up with the novel abstraction of the month.

I should add that I don't hate it, and there's plenty still to appreciate. Some of it is a joy and it's refreshing to work on projects that embrace more functional styles over the typical CRUD and OOP taxonomy construction you get in a typical backend job. Different set of problems once you get away from the typical framework stuff (react, redux, saga boilerplate).

1 comments

I feel like that's more a complaint about the JS frontend ecosystem as a whole. Every paradigm has its own pitfalls and idioms, and at least to me hooks seem better than class components most of the time. You exchange one set of pitfalls with another, and get more pleasant, more composable behavior overall. But compared to many GUI frameworks in other languages it still feels like a mess, and it's a mess that constantly changes from under you.
You're absolutely right. The native platforms aren't perfect, but they're stable and successful.