4 ms·
You can memoize any function with `useCallback`, sync or async. All it's doing is watching when the deps array changes, and saving whatever function reference
by acemarke 3y ago
You can memoize any function with `useCallback`, sync or async. All it's doing is watching when the deps array changes, and saving whatever function reference was passed in at that time.
(Note that this does not mean that the function itself is memoized in terms of "cache the result and check the arguments to see if we know this answer already".)
- sakerbos 3y agoThanks! Yeah those were my thoughts too.