You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/react-devtools.md
+36-15Lines changed: 36 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,26 @@ title: React DevTools
5
5
6
6
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
7
7
8
-
You can use [the standalone version of React Developer Tools](https://github.com/facebook/react/tree/main/packages/react-devtools) to debug the React component hierarchy. To use it, install the `react-devtools` package globally:
8
+
[React DevTools](https://github.com/facebook/react/tree/main/packages/react-devtools) can be used to debug the React component hierarchy within your app.
9
+
10
+
The standalone version of React DevTools allows connecting to React Native apps. To use it, install or run the `react-devtools` package. It should connect to your simulator within a few seconds.
@@ -24,29 +38,36 @@ yarn global add react-devtools
24
38
</TabItem>
25
39
</Tabs>
26
40
27
-
Now run `react-devtools`from the terminal to launch the standalone DevTools app. It should connect to your simulator within a few seconds.
41
+
Then, run the global `react-devtools`command:
28
42
29
-
```shell
43
+
```sh
30
44
react-devtools
31
45
```
32
46
33
-

47
+
</details>
48
+
49
+
<details>
50
+
<summary>💡 Adding React DevTools as a project dependency</summary>
34
51
35
-
:::info
36
52
If you prefer to avoid global installations, you can add `react-devtools` as a project dependency. Add the `react-devtools` package to your project using `npm install --save-dev react-devtools`, then add `"react-devtools": "react-devtools"` to the `scripts` section in your `package.json`, and then run `npm run react-devtools` from your project folder to open the DevTools.
53
+
54
+
</details>
55
+
56
+
:::tip
57
+
Learn more about using DevTools in the [React Developer Tools guide on react.dev](https://react.dev/learn/react-developer-tools).
37
58
:::
38
59
39
-
## Integration with React Native Inspector
60
+
## Integration with the Element Inspector
40
61
41
-
Open the Dev Menu and choose "Toggle Inspector". It will bring up an overlay that lets you tap on any UI element and see information about it:
62
+
React Native provides an Element Inspector, available under the Dev Menu as "Show Element Inspector". The inspector lets you tap on any UI element and see information about it.

44
65
45
-
However, when `react-devtools` is running, Inspector will enter a collapsed mode, and instead use the DevTools as primary UI. In this mode, clicking on something in the simulator will bring up the relevant components in the DevTools:
66
+
When React DevTools is connected, the Element Inspector will enter a **collapsed mode**, and instead use DevTools as the primary UI. In this mode, clicking on something in the simulator will navigate to the relevant component in DevTools.
You can select "Hide Element Inspector" in the same menu to exit this mode.
48
69
49
-
You can choose "Toggle Inspector" in the same menu to exit this mode.
70
+

50
71
51
72
## Debugging application state
52
73
@@ -57,11 +78,11 @@ You can view installation instructions [in the README](https://github.com/infini
57
78
## Troubleshooting
58
79
59
80
:::tip
60
-
Once you have React DevTools running, follow the instructions. If you had your application running prior to opening React DevTools, you may need to [open developer menu](/docs/debugging#accessing-the-dev-menu) to connect them.
81
+
Once you have React DevTools running, follow the instructions. If you had your application running prior to opening React DevTools, you may need to [open the Dev Menu](./debugging#accessing-the-dev-menu) to connect it.
0 commit comments