Skip to content

Commit 824e084

Browse files
committed
Simplify setup wording and keep troubleshooting items out of the TOC
1 parent c6c0132 commit 824e084

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

‎src/content/reference/dev-tools/react-devtools-cdt-mcp.md‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ import App from './App';
6060
createRoot(document.getElementById('root')).render(<App />);
6161
```
6262

63-
The import installs the React DevTools global hook, so it has to run before React initializes. If it runs too late, React won't connect to it, and the tools will report an empty tree.
64-
65-
If the [React Developer Tools](/learn/react-developer-tools) browser extension is already installed, `react-devtools-cdt-mcp` reuses the extension's hook instead of installing a second one, so both keep working.
63+
`react-devtools-cdt-mcp` has to load before React does. If you import it after React, the tools won't see your components.
6664

6765
<Pitfall>
6866

@@ -668,22 +666,22 @@ register();
668666

669667
## Troubleshooting {/*troubleshooting*/}
670668

671-
### My agent doesn't see any React tools {/*my-agent-doesnt-see-any-react-tools*/}
669+
#### My agent doesn't see any React tools {/*my-agent-doesnt-see-any-react-tools*/}
672670

673671
Check that [third-party developer tools](https://developer.chrome.com/blog/devtools-for-agents-3p-tools) are enabled in your Chrome DevTools MCP setup. Then check that the page selected in Chrome DevTools MCP imports `react-devtools-cdt-mcp/register`. The tools are discovered per page, when the page loads or is selected.
674672

675-
### The component tree is empty {/*the-component-tree-is-empty*/}
673+
#### The component tree is empty {/*the-component-tree-is-empty*/}
676674

677675
`react-devtools-cdt-mcp/register` was imported after React initialized. Move the import to the very first line of your entry file, before any import that loads `react-dom`.
678676

679-
### I'm getting an error about a browser-like environment {/*im-getting-an-error-about-a-browser-like-environment*/}
677+
#### I'm getting an error about a browser-like environment {/*im-getting-an-error-about-a-browser-like-environment*/}
680678

681679
`react-devtools-cdt-mcp/register` throws if it's imported outside a browser, for example during server rendering or in tests. Import it only from client-side code, or call `register()` from the package root yourself where it's safe.
682680

683-
### Source locations and owner stacks are empty {/*source-locations-and-owner-stacks-are-empty*/}
681+
#### Source locations and owner stacks are empty {/*source-locations-and-owner-stacks-are-empty*/}
684682

685683
This data only exists in development builds of React. Make sure you're running your app's development server rather than a production build.
686684

687-
### A uid stopped working {/*a-uid-stopped-working*/}
685+
#### A uid stopped working {/*a-uid-stopped-working*/}
688686

689687
Uids don't survive page reloads. After a reload, get fresh uids with `react_get_component_tree` or `react_find_components`.

0 commit comments

Comments
 (0)