React/Optimization/Lesson 19
React.memo
30 min·theory
This chapter
2/2
JavaScript
React.memo
💡 Why should you learn this?
🎯
Prevents unnecessary re-renders, making your app faster.
💼
The performance difference is dramatic when rendering thousands of items in a list.
⚡
It is a go-to answer for performance optimization questions in technical interviews.
🔗
It is the first tool to reach for when resolving performance issues in production.
🏢 실무에서는
In production, React.memo is used on frequently updated screens such as search result lists, infinite scroll feeds, and real-time notification panels. For example, in a search experience similar to Naver Search, each result item can be wrapped in React.memo so that the entire result list does not re-render every time the user types a character.
What is React.memo?
React.memo
A higher-order component (HOC) that skips re-rendering when props have not changed.
When to use it
- ▸When a parent re-renders frequently but child props remain unchanged
- ▸Components with high rendering cost
- ▸Individual items in a list
Changes in React 19
The React Compiler applies memo automatically, so manual usage is becoming less common.
This concept is fundamental to React component development. Understand React's declarative UI paradigm and clearly distinguish the difference between props and state. A component should behave like a pure function — always returning the same output (JSX) for a given input (props).
💡 💡 React.memo Tips
- ▸React 19: Compiler handles it automatically — reduce manual memo usage
- ▸Object/Array Props: Use useMemo to stabilize references
- ▸Callback Props: Use useCallback to stabilize function references
- ▸Measurement: Verify real-world impact with React DevTools Profiler
This concept is fundamental to React component development. Understand React's declarative UI paradigm and clearly distinguish the difference between props and state. A component should behave like a pure function — always returning the same output (JSX) for a given input (props).
⚛️ React Patterns — React.memo
Learn how React.memo is used in React step by step, with code examples.
1
🧩
1. When to use React.memo
Situations where this feature is needed.
↓
2
💻
2. Writing the code
Basic usage of React.memo.
↓
3
🎨
3. Rendering result
What the user sees on screen.
↓
4
💡
4. Practical tips
Common pitfalls and best practices.
🎮 React.memo — Step-by-Step Understanding
Click each step to read the content and track your progress with the 'Got it' button.
🖥️ Result — rendered React component
✏️ React 코드 수정하기 (클릭해서 열기)
⚛️ React 18 + Babel Standalone — see the result first, then edit the code yourself.
Check Quiz
How does React.memo prevent re-rendering?
Read this first: useTransition / useDeferredValue
Up next: Error Boundary + Suspense