Post
The compiler won't wrap an inline function here in useCallback for you because it changes semantics. /cc @gsathya.bsky.social
I'm referring to this discussion: bsky.app/profile/gsat...
Also I just realized a potential bug in the compiler after reading your post! The compiler will automatically move pure functions outside the component, which can break callback ref identity check
youtu.be/7yw_D3h4xSo?... If this video is true, I hope we stop using this term.
youtu.beWhy "Stale Closure" Misleads React DevsYouTube video by UI Engineering
I guess if I make a two-tweet post, it'll get easy to misinterpret it what I meant: if ref callbacks only ran once and used a value from state in a closure, it would use that value for its entire lifetime. subverting this is not idiomatic react
0 reposts3 likes