2 ms·
> I don’t think I’ve ever seen anybody claim that hooks are ‘functional’ That's not quite true. The linked story tries to explain Hooks as algebraic effects. B
by flowerlad 6y ago
> I don’t think I’ve ever seen anybody claim that hooks are ‘functional’
That's not quite true. The linked story tries to explain Hooks as algebraic effects. Before Hooks, functional components were explained as "UI is a function of state". After Hooks, they are continuing on FP ideas as the justification or explanation of their design choices: https://overreacted.io/algebraic-effects-for-the-rest-of-us/ https://overreacted.io/algebraic-effects-for-the-rest-of-us/
- jameshart 6y agoI'm not sure what the problem is with using functional ideas as a justification? It feels like you're complaining about a sort of cultural appropriation. Functional ideas are sometimes good, and they should be borrowed and used in nonfunctional contexts. Like continuation-passing-style got lifted and used to inspire promises and async/await. That doesn't mean languages with async/await are functional, or that programming with async/await is taught as functional, it's just the pedigree of the idea. React hooks lift some ideas from algebraic effects, and embed them in a decidedly nonfunctional, VERY non-pure-functional context. But the pedigree of the idea is still... algebraic effects.