News for hackers. Stuff that matters.
Re:A guide to useEffect in React by anonytrary on Monday March 11, 2019 @05:37PM (#19363084)
You don't need hooks to do any of this, but hooks have everything to do with closures. Hooks are created every single render, unconditionally, guaranteeing that each hook is one-to-one with the render environment that created it. The point of using hooks is that you are always referencing the props and state at the time of creating the hook and not at the time of running the hook. In this way, hooks become part of your rendered output.
Re:A guide to useEffect in React by boomlinde on Monday March 11, 2019 @10:08PM (#19364743)
I know how hooks work, but what you describe has nothing to do with closures.