The Difference Between useMemo and useCallback — An In-Depth Look
A useMemo is called using React source code, while a useCallback is called by the user. UseMemo can be used to memoize expensive functions to avoid having to call them on every render. A variable of usememo contains only the result of the return, which means everything in the body of the argument function is ignored. Using useMemO is a straightforward React hook that takes no parameters and does not require a re-render count. Using a hook that manages the side-effects in functional components is a gamble, but using it is very likely a mistake.
Join Hacker Noon
Create your free account to unlock your custom reading experience.