October 2019
Intermediate to advanced
426 pages
11h 49m
English
This Hook allows us to pass an inline callback function, and an array of dependencies, and will return a memoized version of the callback function. We can use it as follows:
import { useCallback } from 'react'const memoizedCallback = useCallback( () => { doSomething(a, b) }, [a, b])
The useCallback Hook is useful when passing callbacks to optimized child components. It works similarly to the useMemo Hook, but for callback functions.
Read now
Unlock full access