A memoized chart still re-renders
A memoized Chart receives options={{ theme }} and an inline callback from its parent. The parent re-renders while theme stays the same. Assume no React Compiler. Explain why prop memoization can miss, how you would confirm the cost, and how you might fix it.
Model Answer & Explanation
The object and callback are new references on each parent render. By default memo compares each prop using Object.is. Measure with the React Profiler before optimizing. If it matters, pass simpler primitive props, move stable definitions out of the component, or stabilize values with useMemo and useCallback using their real dependencies.
What a Strong Answer Covers
- Explain referential equality rather than comparing object contents.
- Propose a measured fix without hiding real prop changes.