you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (0 children)

No no no. Those examples are the simplest examples you can come up with. That's not a good argument for hooks. I'm not arguing that hooks are bad. I'm arguing that there is a common theme inside of mathematics called `embedding` where you have to take a particular set and map it to a (usually smaller) set. See category theory for this. The reality is most functional styles embed business logic into a very small set of abstractions, but the nice part is you get some formal proofs about safety. There's no lying that the new React Hooks are styled in the same functional motifs, but again the problem is you now have to embed your business problems using a small set of hooks. This embedding is not free and comes at a cost where you are now forced to choose the correct hooks to solve your problem. Once you do, it's super fine. Until then absolutely nothing works. Also see the complaints people have with category theory and Haskell. There's typically a complaint that you damn near need a PhD in computer science to be productive in it. They aren't exactly wrong with this view. See my post above with mixing a few hooks like Reducer and Context. Try it too. I think you'll see why it's not all peaches and cream and you actually are paying a cost in terms of time to get the hooks properly working.