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...