React · Senior · Question 73 of 75

Why might onClick={() => select(item.id)} defeat memo on 1000 list rows?

Explanation

Pass a stable onSelect (via useCallback) and the id as separate props; the row calls onSelect(id). The React Compiler can automate this.

Further reading

Problem with a question

React · Senior · question 73

Test yourself

Take the React · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz