News for hackers. Stuff that matters.
Re:A Critique of React Hooks by throwanem on Monday April 27, 2020 @12:28PM (#22997325)
Who says functions don't have state? Referential transparency requires no such constraint; it only requires that state not leak into or out of a pure function save through its arguments (inward) and return value (outward). Beyond that, what they do within the space of their own lexical scope and the lifetime of their call stack frame is entirely their own business.

I'm familiar with dynamic scoping via Emacs Lisp. I have yet to encounter anything like it in React, and it'd be surprising in any case to encounter dynamic scope in Javascript, a language which does not even support it. The closest I can come to understanding what you must mean here is to think you're very confused about how React props work, but that doesn't seem likely either - I can hardly imagine someone having such an evidently strongly held opinion about something, and having that opinion turn out to be based on a fundamental misunderstanding of the subject.

Would you mind explaining in some more detail the issues you see with React functional components? You mention having an essay's worth of material, and while that's probably more than we need to support a discussion, perhaps you'd be so good as to boil it down to a few points with a little more substance to them than "React developers don't know what they're doing" and "this is insane".

Re:A Critique of React Hooks by pcr910303 on Monday April 27, 2020 @09:54PM (#23002505)
> it'd be surprising in any case to encounter dynamic scope in Javascript, a language which does not even support it.

Doesn't matter much, but just b.c. it's interesting: JavaScript actually does support limited dynamic scoping - `this` is scoped dynamically like in usual Lisps, and there's a with statement[0] that acts somewhat similar with `let` in Lisp.

[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:A Critique of React Hooks by desert_boi on Monday April 27, 2020 @11:44PM (#23003126)
`with` is not allowed in strict mode (from ES5) and with ES modules (which imply strict). It's a bit of a relic.