News for hackers. Stuff that matters.
Re:React: You Might Not Need an Effect by Rapzid on Thursday March 23, 2023 @07:21AM (#35272990)
A bare closure would always see the latest values because it closes over them during render. And the latest useEffect closure will have closed over that method..

Here is the test suite for useEffectEvent and the test ensuring it does not provide a stable reference: https://github.com/facebook/react/blob/main/packages/react-r...

Re:React: You Might Not Need an Effect by andrewingram on Thursday March 23, 2023 @08:12AM (#35273483)
You're right, i'll redact/edit. Hm, this doc page is exceptionally confusing.