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
`"use no memo"`prevents a function from being optimized by React Compiler.
8
+
`"use no memo"`impede que uma função seja otimizada pelo React Compiler.
9
9
10
10
</Intro>
11
11
12
12
<InlineToc />
13
13
14
14
---
15
15
16
-
## Reference {/*reference*/}
16
+
## Referência {/*reference*/}
17
17
18
18
### `"use no memo"` {/*use-no-memo*/}
19
19
20
-
Add`"use no memo"`at the beginning of a function to prevent React Compiler optimization.
20
+
Adicione`"use no memo"`no início de uma função para impedir a otimização do React Compiler.
21
21
22
22
```js {1}
23
23
functionMyComponent() {
@@ -26,122 +26,122 @@ function MyComponent() {
26
26
}
27
27
```
28
28
29
-
When a function contains`"use no memo"`, the React Compiler will skip it entirely during optimization. This is useful as a temporary escape hatch when debugging or when dealing with code that doesn't work correctly with the compiler.
29
+
Quando uma função contém`"use no memo"`, o React Compiler a ignorará completamente durante a otimização. Isso é útil como uma saída de emergência temporária ao depurar ou ao lidar com código que não funciona corretamente com o compilador.
30
30
31
-
#### Caveats {/*caveats*/}
31
+
#### Ressalvas {/*caveats*/}
32
32
33
-
*`"use no memo"`must be at the very beginning of a function body, before any imports or other code (comments are OK).
34
-
*The directive must be written with double or single quotes, not backticks.
35
-
*The directive must exactly match `"use no memo"`or its alias `"use no forget"`.
36
-
*This directive takes precedence over all compilation modes and other directives.
37
-
*It's intended as a temporary debugging tool, not a permanent solution.
33
+
*`"use no memo"`deve estar no início do corpo de uma função, antes de quaisquer imports ou outro código (comentários são OK).
34
+
*A diretiva deve ser escrita com aspas duplas ou simples, não crases.
35
+
*A diretiva deve corresponder exatamente a `"use no memo"`ou seu alias `"use no forget"`.
36
+
*Esta diretiva tem precedência sobre todos os modos de compilação e outras diretivas.
37
+
*Destina-se a ser uma ferramenta de depuração temporária, não uma solução permanente.
38
38
39
-
### How`"use no memo"`opts-out of optimization {/*how-use-no-memo-opts-out*/}
39
+
### Como`"use no memo"`desabilita a otimização {/*how-use-no-memo-opts-out*/}
40
40
41
-
React Compiler analyzes your code at build time to apply optimizations. `"use no memo"`creates an explicit boundary that tells the compiler to skip a function entirely.
41
+
O React Compiler analisa seu código no momento da compilação para aplicar otimizações. `"use no memo"`cria um limite explícito que diz ao compilador para ignorar uma função inteiramente.
42
42
43
-
This directive takes precedence over all other settings:
44
-
*In `all` mode: The function is skipped despite the global setting
45
-
*In `infer` mode: The function is skipped even if heuristics would optimize it
43
+
Esta diretiva tem precedência sobre todas as outras configurações:
44
+
*No modo `all`: A função é ignorada apesar da configuração global
45
+
*No modo `infer`: A função é ignorada mesmo que a heurística a otimize
46
46
47
-
The compiler treats these functions as if the React Compiler wasn't enabled, leaving them exactly as written.
47
+
O compilador trata essas funções como se o React Compiler não estivesse habilitado, deixando-as exatamente como foram escritas.
48
48
49
-
### When to use`"use no memo"` {/*when-to-use*/}
49
+
### Quando usar`"use no memo"` {/*when-to-use*/}
50
50
51
-
`"use no memo"`should be used sparingly and temporarily. Common scenarios include:
51
+
`"use no memo"`deve ser usado com moderação e temporariamente. Cenários comuns incluem:
0 commit comments