How do you optimize a React app?
Measure with the Profiler first, then optimize the real bottlenecks: useMemo for expensive computations, stabilize prop references with useCallback, virtualize long lists, code split routes, and debounce expensive inputs. Never optimize blindly.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in React Performance and Optimization Interview Questions
useMemo memoizes a value, useCallback memoizes a function. useMemo is for expensive computations, useCallback is for stable function references passed to memoized children. Both prevent unnecessary work but serve different cases.
React.memo wraps a component so it re-renders only when its props change by reference. It is used with useCallback and useMemo to prevent re-renders when the parent re-renders but the props have not meaningfully changed.
Virtualize it with a library like react-window so only the visible items render. Also use stable unique keys and avoid inline functions as props to reduce re-renders of list items.
Still have questions?
Browse all our FAQs or reach out to our support team
