Re:A guide to useEffect in React
by boomlinde on Monday March 11, 2019 @06:11AM
(#19357818)
Other than e.g. useEffect returning a function that closes around something within, I don't see what hooks have to do with closures.
[ Parent
| on HN ]
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.