Lesson 2.1

When memo actually helps

memo skips a re-render when props are shallow-equal. It costs a comparison on every render, so applying it everywhere makes things slower, not faster.

Duration
10m
Level
Advanced
Students
6.3k students

Overview

memo skips a re-render when props are shallow-equal. It costs a comparison on every render, so applying it everywhere makes things slower, not faster.

In this lesson you will:

  • Apply memo to expensive subtrees with stable props
  • Understand shallow comparison and why objects defeat it
  • Recognise when restructuring beats memoising

Resources

React documentation

The official reference for the tools used in this lesson.