React · Senior · Question 73 of 75
Why might onClick={() => select(item.id)} defeat memo on 1000 list rows?
- ✓Correct answer: Each render creates new functions for every row, so all memoized rows see changed props
- 2Arrow functions are slower to call
- 3
memodoesn't work with lists
Explanation
Pass a stable onSelect (via useCallback) and the id as separate props; the row calls onSelect(id). The React Compiler can automate this.