A framework for making front-ends.

useMemo vs useCallback

  • Memoizes a thing from a function call vs memoizes the entire function
  • The main difference in use here is that you use something like useMemo to avoid expensive recalculations and something like useCallback to maintain a stable function identity
  • In react, your component is just a function that runs again on another render. Javascript creates a new function object on every render since the callback functions are within the component function.