React · Middle · Question 7 of 75

How are useCallback(fn, deps) and useMemo related?

Explanation

useCallback caches the function itself, useMemo caches the result of calling a function. useCallback doesn't call the passed function or make it run faster. It's useful when the function is passed to a memo component or used as an effect dependency.

Further reading

Problem with a question

React · Middle · question 7

Test yourself

Take the React · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz