React & Web Vitals
agent-browser can inspect React component trees, record re-renders, classify Suspense boundaries, measure Core Web Vitals, and perform SPA navigation.
Enable React inspection
React inspection requires the React DevTools hook to be installed before page JavaScript runs:
If the session already has a browser without the hook, passing --enable react-devtools relaunches that session with the hook installed.
react tree prints the component tree when one is available. If the response contains only a header, no tree was collected. Confirm the page uses React and that a React root has mounted.
React commands
| Command | Description |
|---|---|
react tree | Print the React component tree with fiber IDs |
react inspect <fiberId> | Inspect props, hooks, state, and source for one component |
react renders start | Begin recording component render commits |
react renders stop [--json] | Stop recording and print a render profile |
react suspense [--only-dynamic] [--json] | Walk Suspense boundaries and classify static versus dynamic boundaries |
Web Vitals
vitals works on any site. When a React profiling build is detected, it also reports hydration phases.
By default, vitals prints a summary using the same fields as the structured --json response. Reported metrics include LCP, CLS, TTFB, FCP, INP, and hydration timing when available.
SPA navigation
pushstate performs client-side navigation without forcing a full browser reload. On Next.js apps, it attempts to use window.next.router.push so RSC fetches still run. Other frameworks fall back to history.pushState plus navigation events.
Use open for full navigation and pushstate when the workflow needs SPA behavior.