React · Frontend system thinking
How do you approach React performance optimization?
Short answer
Measure first with the React Profiler, find the component and interaction that is slow, then fix the cause: state placement, unnecessary renders, expensive work, large lists or bundle size. Memoization comes last.
React performance work starts with evidence. Open React DevTools Profiler, record the interaction, and look for components that render often, render for a long time, or render when their props did not meaningfully change. A fast app with a few extra renders is not a problem worth solving.
The usual causes
- State is placed too high, so a small update re-renders a large tree
- An expensive calculation runs during every render
- A long list renders every row instead of virtualizing
- New object or function identities defeat memoized children
- A large bundle blocks interaction until JavaScript loads
- A synchronous update blocks typing or scrolling
function Dashboard() {
const [query, setQuery] = useState("");
return (
<div>
<SearchBox value={query} onChange={setQuery} />
<ExpensiveChart data={staticData} />
</div>
);
}The cheapest fixes are structural: move state down, pass children as props so they keep their identity, split a large component, or use a transition to keep urgent input responsive. Then consider React.memo, useMemo and useCallback where the profiler shows a concrete win.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How do you use the React Profiler?
- 2What does it mean to colocate state?
- 3When should you virtualize a list?
- 4Why can memoization make an app slower?
Say it in the interview
I start by measuring the interaction with the React Profiler rather than guessing. I look for components that render too often or take too long, then fix the underlying cause: state placed too high, expensive render work, unstable props, large lists or bundle size. Structural fixes and state colocation usually help more than sprinkling memo everywhere. I verify the result in a production build.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React mock interview and get scored feedback on depth, clarity and confidence.