Question · JavaScript and React course · Module 9: Modern React Hooks

Difference between useMemo and useCallback

What is the main difference between useMemo and useCallback?

Answer options

  • useMemo memoizes the value returned by a function, while useCallback memoizes the function reference itself
  • useMemo works synchronously, while useCallback works asynchronously
  • useMemo is for class components, useCallback is for functional ones
  • There is no difference, they are aliases for the same hook

You can check the correct answer by solving this task in the CodeWorlds game.