Quick Start
Minimal Setup
Wrap your app root with DevHUD:
import { DevHUD } from "react-performance-monitoring"
function AppRoot() {
return (
<DevHUD>
<App />
</DevHUD>
)
}In development, a floating HUD appears (default: top-right, dark theme) showing:
Last Interaction – ID of the last clicked/typed/submitted element
Total Time – Duration of the current interaction session
API – Total time spent on network calls in that session
Renders – Number of React component renders
Slowest Component – Component with the longest render time
Long Tasks – Count of main-thread blocking tasks
FPS – Current and minimum frame rate
Collapse – Click the × button to fully close the panel; a minimal "RPM" tab remains to re-open it
Reposition – Use the corner icons in the header to move the panel to any corner
Timeline – Click Open Timeline to see a per-event breakdown (renders, network, long tasks) ordered by time
What Happens Under the Hood
- Interaction tracking – Capture-phase listeners for
click,input,submitdetect user actions. - Session grouping – Each interaction starts a session; renders, network calls, long tasks, and FPS samples are grouped into that session.
- Session timeout – After a configurable period of inactivity (default 2000ms), the session closes.
- React Profiler –
DevHUDwraps children in a Profiler and forwards render data to the store. - Network –
window.fetchis patched to record requests; optionally attach an Axios instance for axios calls. - Long tasks –
PerformanceObserverwithentryTypes: ["longtask"]records blocking work. - FPS – A
requestAnimationFrameloop calculates frames per second over 1s intervals.
Tagging Interactions
Interaction IDs are resolved automatically from button text, id, aria-label, placeholder, data-testid, or name. No attributes required:
<button>Load users</button>
<input id="search-filter" placeholder="Search..." />For explicit labels, use data-rpm-id or data-rpm-group. See Tracking Tags for the full resolution order.
Next Steps
- Live Demo – Try it in the browser
- Configuration – Position, theme, toggles
- Axios Integration – Track axios requests
- Examples – Live demo and code samples