React · Senior · Question 47 of 75

Why can React.memo with a custom comparison function be dangerous?

Explanation

arePropsEqual must account for all props, including functions: if you ignore a callback, the component calls its old version with a "frozen" closure. Deep comparison of large data can cost more than the render itself. Stabilizing props is usually the better choice.

Further reading

Problem with a question

React · Senior · question 47

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