5 Things to remember when it comes to React.memo
, useMemo
, useCallBack
Source: Mastering React Memo
React.memo
is not a traditional memoization- React just looks at the previous value and compares it to the new one
- Think of
React.memo
as "Render if props have changed" useMemo
anduseCallBack
are for reference identity- useMemo: objects and arrays
- useCallBack: functions
- Use
useMemo
for expensive calculations - Don't sweat component re-renders too much