From a79a18c3596be9c84130c5a6979b4e1cfb811bbf Mon Sep 17 00:00:00 2001 From: GarlicGo <582149912@qq.com> Date: Wed, 24 May 2023 12:58:10 +0800 Subject: [PATCH 01/14] docs(cn): translate reference/react/Profiler into Chinese --- src/content/reference/react/Profiler.md | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 8e149634ae..493dc88ab2 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -4,7 +4,7 @@ title: -`` lets you measure rendering performance of a React tree programmatically. +`` 允许你以编程的方式测量 React 树的渲染性能。 ```js @@ -18,11 +18,11 @@ title: --- -## Reference {/*reference*/} +## 参考 {/*reference*/} ### `` {/*profiler*/} -Wrap a component tree in a `` to measure its rendering performance. +使用 `` 将组件树包裹起来,以测量其渲染性能。 ```js @@ -32,41 +32,41 @@ Wrap a component tree in a `` to measure its rendering performance. #### Props {/*props*/} -* `id`: A string identifying the part of the UI you are measuring. -* `onRender`: An [`onRender` callback](#onrender-callback) that React calls every time components within the profiled tree update. It receives information about what was rendered and how much time it took. +* `id`: 一个字符串,用于标识你正在测量的 UI 部分。 +* `onRender`: 一个 [`onRender` 回调函数](#onrender-callback),React 在每次被测量组件树中的组件更新时调用它。它接收有关渲染内容和所花费时间的信息。 -#### Caveats {/*caveats*/} +#### 注意 {/*caveats*/} -* Profiling adds some additional overhead, so **it is disabled in the production build by default.** To opt into production profiling, you need to enable a [special production build with profiling enabled.](https://fb.me/react-profiling) +* 进行性能分析会增加一些额外的开销,因此 **在默认情况下,它在生产构建中是被禁用的**。如果要启用生产环境下的性能分析,你需要启用一个 [特殊的带有性能分析功能的生产构建](https://fb.me/react-profiling)。 --- -### `onRender` callback {/*onrender-callback*/} +### `onRender` 回调函数 {/*onrender-callback*/} -React will call your `onRender` callback with information about what was rendered. +React 会使用渲染的相关信息调用你的 `onRender` 回调函数。 ```js function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime) { - // Aggregate or log render timings... + // 对渲染时间进行汇总或记录... } ``` -#### Parameters {/*onrender-parameters*/} +#### 参数 {/*onrender-parameters*/} -* `id`: The string `id` prop of the `` tree that has just committed. This lets you identify which part of the tree was committed if you are using multiple profilers. -* `phase`: `"mount"`, `"update"` or `"nested-update"`. This lets you know whether the tree has just been mounted for the first time or re-rendered due to a change in props, state, or hooks. -* `actualDuration`: The number of milliseconds spent rendering the `` and its descendants for the current update. This indicates how well the subtree makes use of memoization (e.g. [`memo`](/reference/react/memo) and [`useMemo`](/reference/react/useMemo)). Ideally this value should decrease significantly after the initial mount as many of the descendants will only need to re-render if their specific props change. -* `baseDuration`: The number of milliseconds estimating how much time it would take to re-render the entire `` subtree without any optimizations. It is calculated by summing up the most recent render durations of each component in the tree. This value estimates a worst-case cost of rendering (e.g. the initial mount or a tree with no memoization). Compare `actualDuration` against it to see if memoization is working. -* `startTime`: A numeric timestamp for when React began rendering the current update. -* `endTime`: A numeric timestamp for when React committed the current update. This value is shared between all profilers in a commit, enabling them to be grouped if desirable. +* `id`: `` 树的字符串 `id` 属性,用于标识刚刚提交的部分。如果你使用多个性能分析器,可以通过此属性识别已提交的树的哪个部分。 +* `phase`: `"mount"`、`"update"` 或 `"nested-update"`。这可以让你知道树是首次挂载还是由于属性、状态或 hook 的更改而重新渲染。 +* `actualDuration`: 当前更新期间用于渲染 `` 及其后代的时间,以毫秒为单位。显示子树在使用记忆化(例如 [`memo`](/reference/react/memo) 和 [`useMemo`](/reference/react/useMemo))方面的效果如何。理想情况下,此值在初始挂载后应显著减少,因为许多后代组件只会在其特定的 props 变化时需要重新渲染。 +* `baseDuration`: 估计在没有任何优化的情况下重新渲染整个 `` 子树所需的时间,以毫秒为单位。它通过累加树中每个组件的最近一次渲染持续时间来计算。此值估计了渲染的最差情况成本(例如初始挂载或没有记忆化的树)。与 `actualDuration` 进行比较,以确定记忆化是否起作用。 +* `startTime`: 当 React 开始渲染当前更新时的时间戳。 +* `endTime`: 当 React 提交当前更新时的时间戳。此值在提交的所有性能分析器之间共享,如果需要,可以对它们进行分组。 --- -## Usage {/*usage*/} +## 使用方法 {/*usage*/} -### Measuring rendering performance programmatically {/*measuring-rendering-performance-programmatically*/} +### 以编程的方式测量渲染性能 {/*measuring-rendering-performance-programmatically*/} -Wrap the `` component around a React tree to measure its rendering performance. +将 `` 组件包裹在 React 树周围以测量其渲染性能。 ```js {2,4} @@ -77,25 +77,25 @@ Wrap the `` component around a React tree to measure its rendering per ``` -It requires two props: an `id` (string) and an `onRender` callback (function) which React calls any time a component within the tree "commits" an update. +这需要两个属性:`id`(字符串)和 `onRender` 回调函数(函数),React 在树中的任何组件“提交”更新时调用该函数。 -Profiling adds some additional overhead, so **it is disabled in the production build by default.** To opt into production profiling, you need to enable a [special production build with profiling enabled.](https://fb.me/react-profiling) +进行性能分析会增加一些额外的开销,因此 **默认情况下,在生产构建中禁用了性能分析**。要启用生产环境下的性能分析,你需要启用一个 [带有性能分析功能的特殊生产构建](https://fb.me/react-profiling)。 -`` lets you gather measurements programmatically. If you're looking for an interactive profiler, try the Profiler tab in [React Developer Tools](/learn/react-developer-tools). It exposes similar functionality as a browser extension. +`` 允许你以编程方式收集性能测量数据。如果你正在寻找一个交互式的性能分析工具,可以尝试使用 [React Developer Tools](/learn/react-developer-tools) 中的 Profiler 标签页。它提供了类似浏览器扩展的功能。 --- -### Measuring different parts of the application {/*measuring-different-parts-of-the-application*/} +### 测量应用的不同部分 {/*measuring-different-parts-of-the-application*/} -You can use multiple `` components to measure different parts of your application: +你可以使用多个 `` 组件来测量你的应用的不同部分: ```js {5,7} @@ -108,7 +108,7 @@ You can use multiple `` components to measure different parts of your ``` -You can also nest `` components: +你还可以嵌套 `` 组件: ```js {5,7,9,12} @@ -126,7 +126,7 @@ You can also nest `` components: ``` -Although `` is a lightweight component, it should be used only when necessary. Each use adds some CPU and memory overhead to an application. +虽然 `` 是一个轻量级组件,但它应该仅在必要时使用。每次使用都会给应用增加一些 CPU 和内存开销。 --- From 039d4b4841bb539b8593918d24d4a0e5be95f85f Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:44:11 +0800 Subject: [PATCH 02/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 493dc88ab2..8c11954dd5 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -4,7 +4,7 @@ title: -`` 允许你以编程的方式测量 React 树的渲染性能。 +`` 允许你编程时测量 React 树的渲染性能。 ```js From c6041f857d9fa78a3c8e25f59f3436a19b053d48 Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:44:41 +0800 Subject: [PATCH 03/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 8c11954dd5..e00c538acd 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -62,7 +62,7 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime --- -## 使用方法 {/*usage*/} +## 用法 {/*usage*/} ### 以编程的方式测量渲染性能 {/*measuring-rendering-performance-programmatically*/} From fb3d303ecc22fc6eb87cda90398dd80a0feaced6 Mon Sep 17 00:00:00 2001 From: GarlicGo <582149912@qq.com> Date: Mon, 19 Jun 2023 14:57:16 +0800 Subject: [PATCH 04/14] feat: update --- src/content/reference/react/Profiler.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index e00c538acd..f8893ed981 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -30,10 +30,10 @@ title: ``` -#### Props {/*props*/} +#### 参数 {/*props*/} * `id`: 一个字符串,用于标识你正在测量的 UI 部分。 -* `onRender`: 一个 [`onRender` 回调函数](#onrender-callback),React 在每次被测量组件树中的组件更新时调用它。它接收有关渲染内容和所花费时间的信息。 +* `onRender`: 一个 [`onRender` 回调函数](#onrender-callback),当测量组件树中的组件更新时,React会调用它。它接收有关渲染内容和所花费时间的信息。 #### 注意 {/*caveats*/} @@ -53,18 +53,18 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime #### 参数 {/*onrender-parameters*/} -* `id`: `` 树的字符串 `id` 属性,用于标识刚刚提交的部分。如果你使用多个性能分析器,可以通过此属性识别已提交的树的哪个部分。 -* `phase`: `"mount"`、`"update"` 或 `"nested-update"`。这可以让你知道树是首次挂载还是由于属性、状态或 hook 的更改而重新渲染。 -* `actualDuration`: 当前更新期间用于渲染 `` 及其后代的时间,以毫秒为单位。显示子树在使用记忆化(例如 [`memo`](/reference/react/memo) 和 [`useMemo`](/reference/react/useMemo))方面的效果如何。理想情况下,此值在初始挂载后应显著减少,因为许多后代组件只会在其特定的 props 变化时需要重新渲染。 -* `baseDuration`: 估计在没有任何优化的情况下重新渲染整个 `` 子树所需的时间,以毫秒为单位。它通过累加树中每个组件的最近一次渲染持续时间来计算。此值估计了渲染的最差情况成本(例如初始挂载或没有记忆化的树)。与 `actualDuration` 进行比较,以确定记忆化是否起作用。 -* `startTime`: 当 React 开始渲染当前更新时的时间戳。 -* `endTime`: 当 React 提交当前更新时的时间戳。此值在提交的所有性能分析器之间共享,如果需要,可以对它们进行分组。 +* `id`:`` 树的字符串 `id` 属性,用于标识刚刚提交的部分。如果你使用多个性能分析器,可以通过此属性识别已提交的树的哪个部分。 +* `phase`:`"mount"`、`"update"` 或 `"nested-update"`。这可以让你知道树是首次挂载还是由于属性、状态或 hook 的更改而重新渲染。 +* `actualDuration`:当前更新期间用于渲染 `` 及其后代的时间,以毫秒为单位。显示子树在使用记忆化(例如 [`memo`](/reference/react/memo) 和 [`useMemo`](/reference/react/useMemo))方面的效果如何。理想情况下,此值在初始挂载后应显著减少,因为许多后代组件只会在其特定的 props 变化时需要重新渲染。 +* `baseDuration`:估计在没有任何优化的情况下重新渲染整个 `` 子树所需的时间,以毫秒为单位。它通过累加树中每个组件的最近一次渲染持续时间来计算。此值估计了渲染的最差情况成本(例如初始挂载或没有记忆化的树)。与 `actualDuration` 进行比较,以确定记忆化是否起作用。 +* `startTime`:当 React 开始渲染当前更新时的时间戳。 +* `endTime`:当 React 提交当前更新时的时间戳。此值在提交的所有性能分析器之间共享,如果需要,可以对它们进行分组。 --- ## 用法 {/*usage*/} -### 以编程的方式测量渲染性能 {/*measuring-rendering-performance-programmatically*/} +### 编程式测量渲染性能 {/*measuring-rendering-performance-programmatically*/} 将 `` 组件包裹在 React 树周围以测量其渲染性能。 From 3cb4332d9325c82615b9cfcb8540462d95570b9e Mon Sep 17 00:00:00 2001 From: GarlicGo <582149912@qq.com> Date: Mon, 19 Jun 2023 20:38:33 +0800 Subject: [PATCH 05/14] feat: update --- src/content/reference/react/Profiler.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index f8893ed981..ad87ff82c3 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -32,8 +32,8 @@ title: #### 参数 {/*props*/} -* `id`: 一个字符串,用于标识你正在测量的 UI 部分。 -* `onRender`: 一个 [`onRender` 回调函数](#onrender-callback),当测量组件树中的组件更新时,React会调用它。它接收有关渲染内容和所花费时间的信息。 +* `id`:一个字符串,用于标识你正在测量的 UI 部分。 +* `onRender`:一个 [`onRender` 回调函数](#onrender-callback),当测量组件树中的组件更新时,React会调用它。它接收有关渲染内容和所花费时间的信息。 #### 注意 {/*caveats*/} From 38c3b9e668037d7810f45f07588776801444bc5f Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:10:18 +0800 Subject: [PATCH 06/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index ad87ff82c3..48cf82c333 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -4,7 +4,7 @@ title: -`` 允许你编程时测量 React 树的渲染性能。 +`` 允许你编程式测量 React 树的渲染性能。 ```js From 72b20a4d555b96a387d170cd0d1e4ecc180c4d5a Mon Sep 17 00:00:00 2001 From: GarlicGo <582149912@qq.com> Date: Mon, 26 Jun 2023 13:12:19 +0800 Subject: [PATCH 07/14] docs: update --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 48cf82c333..64cb40c648 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -87,7 +87,7 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime -`` 允许你以编程方式收集性能测量数据。如果你正在寻找一个交互式的性能分析工具,可以尝试使用 [React Developer Tools](/learn/react-developer-tools) 中的 Profiler 标签页。它提供了类似浏览器扩展的功能。 +`` 允许你编程式收集性能测量数据。如果你正在寻找一个交互式的性能分析工具,可以尝试使用 [React Developer Tools](/learn/react-developer-tools) 中的 Profiler 标签页。它提供了类似浏览器扩展的功能。 From ead0a4b7e0dbb5c54e12e125a5575ec0965d00aa Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:18:37 +0800 Subject: [PATCH 08/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 64cb40c648..9227865a28 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -22,7 +22,7 @@ title: ### `` {/*profiler*/} -使用 `` 将组件树包裹起来,以测量其渲染性能。 +使用 `` 包裹组件树,以测量其渲染性能。 ```js From 6b2e1130b42b4e52bbfb520f60b0f811b1bd0cf4 Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:18:45 +0800 Subject: [PATCH 09/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 9227865a28..dbc86a4d66 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -32,7 +32,7 @@ title: #### 参数 {/*props*/} -* `id`:一个字符串,用于标识你正在测量的 UI 部分。 +* `id`:字符串,用于标识正在测量的 UI 部分。 * `onRender`:一个 [`onRender` 回调函数](#onrender-callback),当测量组件树中的组件更新时,React会调用它。它接收有关渲染内容和所花费时间的信息。 #### 注意 {/*caveats*/} From 3cf9057d6e62808def8bb88ad18cb66dcecfcc84 Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:18:52 +0800 Subject: [PATCH 10/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index dbc86a4d66..f2605084df 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -33,7 +33,7 @@ title: #### 参数 {/*props*/} * `id`:字符串,用于标识正在测量的 UI 部分。 -* `onRender`:一个 [`onRender` 回调函数](#onrender-callback),当测量组件树中的组件更新时,React会调用它。它接收有关渲染内容和所花费时间的信息。 +* `onRender`:[`onRender` 回调函数](#onrender-callback),当 profiled 树中的组件更新时,React 都会调用它。它接收有关渲染内容和所花费时间的信息。 #### 注意 {/*caveats*/} From 8e6a4510216dc4573730e69307e2a3f79c35299e Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:19:02 +0800 Subject: [PATCH 11/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index f2605084df..411019609d 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -37,7 +37,7 @@ title: #### 注意 {/*caveats*/} -* 进行性能分析会增加一些额外的开销,因此 **在默认情况下,它在生产构建中是被禁用的**。如果要启用生产环境下的性能分析,你需要启用一个 [特殊的带有性能分析功能的生产构建](https://fb.me/react-profiling)。 +* 进行性能分析会增加一些额外的开销,因此 **在默认情况下,它在生产环境中是被禁用的**。如果要启用生产环境下的性能分析,你需要启用一个 [特殊的带有性能分析功能的生产构建](https://fb.me/react-profiling)。 --- From 5c90530b7f736a8b18ce45f6c61181c40c4bd6f2 Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:19:09 +0800 Subject: [PATCH 12/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 411019609d..54e2562a32 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -53,7 +53,7 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime #### 参数 {/*onrender-parameters*/} -* `id`:`` 树的字符串 `id` 属性,用于标识刚刚提交的部分。如果你使用多个性能分析器,可以通过此属性识别已提交的树的哪个部分。 +* `id`:`` 树的字符串 `id` 属性,用于标识刚刚提交的部分。如果你使用多个 profiler,可以通过此属性识别已提交的树的哪个部分。 * `phase`:`"mount"`、`"update"` 或 `"nested-update"`。这可以让你知道树是首次挂载还是由于属性、状态或 hook 的更改而重新渲染。 * `actualDuration`:当前更新期间用于渲染 `` 及其后代的时间,以毫秒为单位。显示子树在使用记忆化(例如 [`memo`](/reference/react/memo) 和 [`useMemo`](/reference/react/useMemo))方面的效果如何。理想情况下,此值在初始挂载后应显著减少,因为许多后代组件只会在其特定的 props 变化时需要重新渲染。 * `baseDuration`:估计在没有任何优化的情况下重新渲染整个 `` 子树所需的时间,以毫秒为单位。它通过累加树中每个组件的最近一次渲染持续时间来计算。此值估计了渲染的最差情况成本(例如初始挂载或没有记忆化的树)。与 `actualDuration` 进行比较,以确定记忆化是否起作用。 From 9087ba4e6a95b628361479111b8e6cf1f39750c5 Mon Sep 17 00:00:00 2001 From: GarlicGo <50868054+GarlicGo@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:19:18 +0800 Subject: [PATCH 13/14] Apply suggestions from code review Co-authored-by: Yucohny <79147654+Yucohny@users.noreply.github.com> --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index 54e2562a32..da564ac562 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -66,7 +66,7 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime ### 编程式测量渲染性能 {/*measuring-rendering-performance-programmatically*/} -将 `` 组件包裹在 React 树周围以测量其渲染性能。 +使用 `` 组件包裹 React 树以测量其渲染性能。 ```js {2,4} From 8a36eb4c7b107fe8f12fa3069fd212af16301c0a Mon Sep 17 00:00:00 2001 From: GarlicGo <582149912@qq.com> Date: Tue, 27 Jun 2023 18:21:01 +0800 Subject: [PATCH 14/14] docs: update --- src/content/reference/react/Profiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/Profiler.md b/src/content/reference/react/Profiler.md index da564ac562..8fee7cdbfd 100644 --- a/src/content/reference/react/Profiler.md +++ b/src/content/reference/react/Profiler.md @@ -81,7 +81,7 @@ function onRender(id, phase, actualDuration, baseDuration, startTime, commitTime -进行性能分析会增加一些额外的开销,因此 **默认情况下,在生产构建中禁用了性能分析**。要启用生产环境下的性能分析,你需要启用一个 [带有性能分析功能的特殊生产构建](https://fb.me/react-profiling)。 +进行性能分析会增加一些额外的开销,因此 **在默认情况下,它在生产环境中是被禁用的**。如果要启用生产环境下的性能分析,你需要启用一个 [特殊的带有性能分析功能的生产构建](https://fb.me/react-profiling)。