[Feature request] Hook to opt in to latest value in closures
nathggns opened this issue · 1 comments
nathggns commented
Currently in function components, props captured in closures reflect the relevant render value of that prop. It is possible to opt in being able to access the latest value using a combination of useRef
and useEffect
. However, this is poorly understood, and I think a native useLatest
hook (potentially implemented using useRef
and useEffect
) would go a long way to bridging that gap.
gaearon commented
Hi, thanks for your suggestion. RFCs should be submitted as pull requests, not issues. I will close this issue but feel free to resubmit in the PR format.