1
1
---
2
- title : React Developer Tools
2
+ title : React 開發者工具
3
3
---
4
4
5
5
<Intro >
6
6
7
- Use React Developer Tools to inspect React [ components ] ( /learn/your-first-component ) , edit [ props] ( /learn/passing-props-to-a-component ) and [ state] ( /learn/state-a-components-memory ) , and identify performance problems.
7
+ 使用 React 開發者工具檢查 React [ component ] ( /learn/your-first-component ) 、編輯 [ props] ( /learn/passing-props-to-a-component ) 和 [ state] ( /learn/state-a-components-memory ) ,並辨認效能問題。
8
8
9
9
</Intro >
10
10
11
- ## Browser extension {/* browser-extension* /}
11
+ ## 瀏覽器擴充元件 {/* browser-extension* /}
12
12
13
- The easiest way to debug websites built with React is to install the React Developer Tools browser extension. It is available for several popular browsers:
13
+ 要 debug 用 React 建構的網站最簡單的方式是安裝 React 開發者瀏覽器擴充元件。它可以在一些流行的瀏覽器上使用:
14
14
15
15
* [ Install for ** Chrome** ] ( https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en )
16
16
* [ Install for ** Firefox** ] ( https://addons.mozilla.org/en-US/firefox/addon/react-devtools/ )
17
17
* [ Install for ** Edge** ] ( https://microsoftedge.microsoft.com/addons/detail/react-developer-tools/gpphkfbcpidddadnkolkpfckpihlkkil )
18
18
19
- Now, if you visit a website ** built with React** , you will see the _ Components_ and _ Profiler_ panels.
19
+ 現在,如果你拜訪 ** 用 React 建構 ** 的網站,你將會看到 _ Components_ 和 _ Profiler_ 控制面板。
20
20
21
21
![ React Developer Tools extension] ( /images/docs/react-devtools-extension.png )
22
22
23
- ### Safari and other browsers {/* safari-and-other-browsers* /}
24
- For other browsers (for example, Safari), install the [ ` react-devtools ` ] ( https://www.npmjs.com/package/react-devtools ) npm package:
23
+ ### Safari 和其他瀏覽器 {/* safari-and-other-browsers* /}
24
+ 對於其他的瀏覽器(例如, Safari),安裝 [ ` react-devtools ` ] ( https://www.npmjs.com/package/react-devtools ) npm package:
25
25
``` bash
26
26
# Yarn
27
27
yarn global add react-devtools
@@ -30,26 +30,26 @@ yarn global add react-devtools
30
30
npm install -g react-devtools
31
31
```
32
32
33
- Next open the developer tools from the terminal:
33
+ 接著從 terminal 打開開發者工具:
34
34
``` bash
35
35
react-devtools
36
36
```
37
37
38
- Then connect your website by adding the following ` <script >` tag to the beginning of your website's ` <head> ` :
38
+ 然後透過在你的網站 ` <head >` 的起始加入以下 ` <script> ` tag 來連接你的網站:
39
39
``` html {3}
40
40
<html >
41
41
<head >
42
42
<script src =" http://localhost:8097" ></script >
43
43
```
44
44
45
- Reload your website in the browser now to view it in developer tools.
45
+ 重新載入網頁現在你可以看到開發者工具。
46
46
47
47
![ React Developer Tools standalone] ( /images/docs/react-devtools-standalone.png )
48
48
49
49
## Mobile (React Native) {/* mobile-react-native* /}
50
- React Developer Tools can be used to inspect apps built with [ React Native] ( https://reactnative.dev/ ) as well.
50
+ React 開發者工具也可以用來檢測由 [ React Native] ( https://reactnative.dev/ ) 建構的應用程式。
51
51
52
- The easiest way to use React Developer Tools is to install it globally:
52
+ 使用 React 開發者工具最簡單的方式就是全域安裝它:
53
53
``` bash
54
54
# Yarn
55
55
yarn global add react-devtools
@@ -58,13 +58,13 @@ yarn global add react-devtools
58
58
npm install -g react-devtools
59
59
```
60
60
61
- Next open the developer tools from the terminal.
61
+ 接著從 terminal 打開開發者工具:
62
62
``` bash
63
63
react-devtools
64
64
```
65
65
66
- It should connect to any local React Native app that's running.
66
+ 它應該連接到你任何在本機端執行的 React Native 應用程式。
67
67
68
- > Try reloading the app if developer tools doesn't connect after a few seconds.
68
+ > 如果在幾秒鐘內沒有連接上開發者工具,請嘗試重新載入應用程式。
69
69
70
- [ Learn more about debugging React Native. ] ( https://reactnative.dev/docs/debugging )
70
+ [ 學習更多關於 React Native 的 debugging。 ] ( https://reactnative.dev/docs/debugging )
0 commit comments