File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/content/reference/react-compiler/directives Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ titleForTitleTag: "'use memo' 指令"
55
66<Intro >
77
8- ` "use memo" ` 用于标记一个函数,以便 React 编译器对其进行优化。
8+ ` "use memo" ` 用于标记一个函数,以便 React 编译器对其进行优化。
99
1010</Intro >
1111
@@ -104,7 +104,7 @@ function ButtonGroup({ buttons }) {
104104module .exports = {
105105 plugins: [
106106 [' babel-plugin-react-compiler' , {
107- compilationMode: ' annotation' // 或 'infer' 或 'all'
107+ compilationMode: ' annotation' // 或 'infer' 和 'all'
108108 }]
109109 ]
110110};
@@ -124,7 +124,7 @@ function ProductList({ products }) {
124124}
125125```
126126
127- #### Infer 模式(默认) {/* infer-mode-example* /}
127+ #### Infer 模式(默认){/* infer-mode-example* /}
128128``` js
129129// 会被自动记忆化,因为它的命名符合组件规范
130130function ComplexDashboard ({ data }) {
@@ -148,9 +148,9 @@ function simpleDisplay({ text }) {
148148要确认你的组件是否被成功优化,可以:
149149
1501501 . 检查你构建产物中被编译后的输出代码
151- 2 . 使用 React 开发工具检查组件是否带有 Memo ✨ 徽章
151+ 2 . 使用 React 开发工具检查组件是否带有 Memo ✨ 徽章
152152
153- ### 另请参阅 {/* see-also* /}
153+ ### 参见 {/* see-also* /}
154154
155155* [ ` "use no memo" ` ] ( /reference/react-compiler/directives/use-no-memo ) - 选择退出编译
156156* [ ` compilationMode ` ] ( /reference/react-compiler/compilationMode ) - 配置编译行为
You can’t perform that action at this time.
0 commit comments