rfcs
rfcs copied to clipboard
RFC: Invalidate stale useCallback functions
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.