React.memo

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 Apr 5 15:4
Editor
Edited
Edited
2025 Oct 21 15:1
Refs
React.memo is a higher-order component that prevents unnecessary re-renders of child components when their parent component changes. It preserves the child component's previous render if its props haven't changed.
React.memo was designed to incorporate functionality similar to PureComponent and shouldComponentUpdate. It accepts two arguments:
  1. The component to be memoized
  1. An optional comparison function to determine if the component should re-render
By default, React.memo performs a shallow comparison of props. The comparison function works opposite to shouldComponentUpdate:
  • true: Props are equal, skip re-rendering
  • false: Props differ, proceed with re-rendering
 
 
 
 
 
 

 

Recommendations