React·100 questions

What is React.memo and how does it work?

Answer
Wraps a component and skips re-rendering if props haven't changed (shallow).
Shallow comparison.
You can pass a custom comparison function.
Stabilize props (useMemo/useCallback).
Don't forget about context: it will still cause re-rendering.
Was this answer helpful?

More questions in this topic

Related questions from other topics