Profiler
A React component, and a React DevTools tab, that measures how often and how long parts of the tree render.
In more detail
Wrap a subtree in <Profiler id="app" onRender={fn}> and React calls fn after each commit with the phase (mount or update), actualDuration and baseDuration. Profile before optimising, so you fix measured slow spots rather than guesses.
Related terms
- React DevTools — A browser extension from the React team that shows the component tree with its props, state and hooks, and records rendering performance.
- actualDuration and baseDuration — The two Profiler timings: actualDuration is how long this commit took to render, and baseDuration estimates how long the whole subtree would take without any memoization.
- flame graph — A chart of profiling data in which each bar is a function or component, its width shows how much time it took, and its position shows what called it.
- premature optimization — Adding speed tricks before measuring that there is a real performance problem.
Taught in
- Complex State with useReducer: State Machines And Action Types — React 19 & Modern Component Architecture
- Keys In Depth: Identity Preservation And Identity Resetting — React 19 & Modern Component Architecture
- useLayoutEffect vs useEffect: Painting And Synchronous Reads — React 19 & Modern Component Architecture
- useContext in Depth: Scoping, Consumer Subscription Costs — React 19 & Modern Component Architecture
- Suspense Architecture: Promises, Fallbacks, And Co-ordination — React 19 & Modern Component Architecture
- Client-Side Data Fetching Architectures with Suspense — React 19 & Modern Component Architecture
- Render Diagnostics: Profiling Re-Renders with React DevTools — React 19 & Modern Component Architecture