React.memo is a higher-order function that memoizes a component. "Under the hood" it creates a special Fiber node type with a memoizedProps flag.
Simple analogy: Imagine a guard at the building entrance.
How it works inside React:
When React.memo works in vain: If you pass an object or function that is recreated on every render, React.memo is useless:
1// BAD: every render creates new style object2<Button style={{ color: 'red' }} />34// GOOD: object is stable5const style = { color: 'red' };6<Button style={style} />
In such cases you need useMemo (for objects) and useCallback (for functions).
React Compiler (React 19+): automatically makes React.memo redundant — the compiler itself determines which components need to be memoized.