By Rahul — Google Frontend Engineer
Rule 1: Measure Before Optimizing
Never optimize blindly. Use React DevTools Profiler to identify what is actually slow. Most performance problems come from unnecessary re-renders, not slow computations.
Preventing Unnecessary Re-renders
React.memo
useMemo and useCallback
Code Splitting
Virtualization for Long Lists
State Management
Production Checklist
- Profile first — identify actual bottlenecks
- Virtualize lists over 100 items
- Code-split routes and heavy components
- Memoize expensive computations
- Use production builds (React dev mode is 10x slower)
- Avoid anonymous objects/arrays as props:
style={{color: 'red'}}creates new object every render
Summary
Measure first. Prevent unnecessary re-renders with memo, useMemo, useCallback. Code-split aggressively. Virtualize long lists. Colocate state. These patterns handle 95% of React performance issues.