October 2019
Intermediate to advanced
426 pages
11h 49m
English
The useCallback Hook works similarly to the useMemo Hook. However, it returns a memoized callback function instead of a value:
const memoizedCallback = useCallback( () => doSomething(a, b, c), [a, b, c])
The previous code is similar to the following useMemo Hook:
const memoizedCallback = useMemo( () => () => doSomething(a, b, c), [a, b, c])
The function returned will only be redefined if one of the dependency values passed in the array of the second argument changes.
Read now
Unlock full access