Skip to main content

Component Re-rendering and React.memo

Learn Component Re-rendering and React.memo (Phase 12 · Performance Optimization (Important), ReactJS) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

When does a component re-render? • A component re-renders when its state changes, when its parent re-renders (even if its props are identical), or when a context it reads changes. • Re-rendering means calling the function again to compute JSX; React then diffs and updates only changed DOM. Most re-renders are cheap and fine. • Find real problems first: React DevTools Profiler ("Highlight updates", flamegraph) and the browser Performance tab. Optimise what is measurably slow.

More lessons in Phase 12 · Performance Optimization (Important)