rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

RFC: Invalidate stale useCallback functions

Open incepter opened this issue 3 years ago • 0 comments

This RFC aim to invalidate the previous functions returned from useCallback as a way to prevent state functions from being invoked.

useCallbacks return functions are usually used as a way to update state from an async context while closing over some other variable. This leads in most of the cases to a stale state of the component and inconsistencies, plus memory leaks referencing lots of closure variables.

View formatted RFC.

incepter avatar Oct 21 '22 10:10 incepter