Question 5 of 10Pro Only

How does React.memo work? When should you use it and how do you write a custom comparison function?

Sample answer preview

React.memo is a higher-order function that memoizes a functional component. The component only re-renders if its props have changed, using shallow comparison by default. Basic usage is as follows.

React.memomemoizationshallow comparisonareEqualperformancepure component

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Frontend Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime