Skip to content

Commit a7bae12

Browse files
docs: translate use-no-memo.md to Português (Brasil)
1 parent 630bc3f commit a7bae12

1 file changed

Lines changed: 49 additions & 49 deletions

File tree

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
22
title: "use no memo"
3-
titleForTitleTag: "'use no memo' directive"
3+
titleForTitleTag: "Diretiva 'use no memo'"
44
---
55

66
<Intro>
77

8-
`"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.
99

1010
</Intro>
1111

1212
<InlineToc />
1313

1414
---
1515

16-
## Reference {/*reference*/}
16+
## Referência {/*reference*/}
1717

1818
### `"use no memo"` {/*use-no-memo*/}
1919

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.
2121

2222
```js {1}
2323
function MyComponent() {
@@ -26,122 +26,122 @@ function MyComponent() {
2626
}
2727
```
2828

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.
3030

31-
#### Caveats {/*caveats*/}
31+
#### Ressalvas {/*caveats*/}
3232

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.
3838

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*/}
4040

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.
4242

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
4646

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.
4848

49-
### When to use `"use no memo"` {/*when-to-use*/}
49+
### Quando usar `"use no memo"` {/*when-to-use*/}
5050

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:
5252

53-
#### Debugging compiler issues {/*debugging-compiler*/}
54-
When you suspect the compiler is causing issues, temporarily disable optimization to isolate the problem:
53+
#### Depurando problemas do compilador {/*debugging-compiler*/}
54+
Quando você suspeitar que o compilador está causando problemas, desabilite temporariamente a otimização para isolar o problema:
5555

5656
```js
5757
function ProblematicComponent({ data }) {
58-
"use no memo"; // TODO: Remove after fixing issue #123
58+
"use no memo"; // TODO: Remover após corrigir o problema #123
5959

60-
// Rules of React violations that weren't statically detected
60+
// Violações das Regras do React que não foram detectadas estaticamente
6161
// ...
6262
}
6363
```
6464

65-
#### Third-party library integration {/*third-party*/}
66-
When integrating with libraries that might not be compatible with the compiler:
65+
#### Integração de bibliotecas de terceiros {/*third-party*/}
66+
Ao integrar com bibliotecas que podem não ser compatíveis com o compilador:
6767

6868
```js
6969
function ThirdPartyWrapper() {
7070
"use no memo";
7171

72-
useThirdPartyHook(); // Has side effects that compiler might optimize incorrectly
72+
useThirdPartyHook(); // Tem efeitos colaterais que o compilador pode otimizar incorretamente
7373
// ...
7474
}
7575
```
7676

7777
---
7878

79-
## Usage {/*usage*/}
79+
## Uso {/*usage*/}
8080

81-
The `"use no memo"` directive is placed at the beginning of a function body to prevent React Compiler from optimizing that function:
81+
A diretiva `"use no memo"` é colocada no início do corpo de uma função para impedir que o React Compiler otimize essa função:
8282

8383
```js
8484
function MyComponent() {
8585
"use no memo";
86-
// Function body
86+
// Corpo da função
8787
}
8888
```
8989

90-
The directive can also be placed at the top of a file to affect all functions in that module:
90+
A diretiva também pode ser colocada no topo de um arquivo para afetar todas as funções naquele módulo:
9191

9292
```js
9393
"use no memo";
9494

95-
// All functions in this file will be skipped by the compiler
95+
// Todas as funções neste arquivo serão ignoradas pelo compilador
9696
```
9797

98-
`"use no memo"` at the function level overrides the module level directive.
98+
`"use no memo"` no nível da função substitui a diretiva no nível do módulo.
9999

100100
---
101101

102-
## Troubleshooting {/*troubleshooting*/}
102+
## Solução de problemas {/*troubleshooting*/}
103103

104-
### Directive not preventing compilation {/*not-preventing*/}
104+
### Diretiva não impedindo a compilação {/*not-preventing*/}
105105

106-
If `"use no memo"` isn't working:
106+
Se `"use no memo"` não estiver funcionando:
107107

108108
```js
109-
//Wrong - directive after code
109+
//Errado - diretiva após o código
110110
function Component() {
111111
const data = getData();
112-
"use no memo"; // Too late!
112+
"use no memo"; // Tarde demais!
113113
}
114114

115-
//Correct - directive first
115+
//Correto - diretiva primeiro
116116
function Component() {
117117
"use no memo";
118118
const data = getData();
119119
}
120120
```
121121

122-
Also check:
123-
* Spelling - must be exactly `"use no memo"`
124-
* Quotes - must use single or double quotes, not backticks
122+
Verifique também:
123+
* Ortografia - deve ser exatamente `"use no memo"`
124+
* Aspas - deve usar aspas simples ou duplas, não crases
125125

126-
### Best practices {/*best-practices*/}
126+
### Melhores práticas {/*best-practices*/}
127127

128-
**Always document why** you're disabling optimization:
128+
**Sempre documente o porquê** você está desabilitando a otimização:
129129

130130
```js
131-
//Good - clear explanation and tracking
131+
//Bom - explicação clara e rastreamento
132132
function DataProcessor() {
133-
"use no memo"; // TODO: Remove after fixing rule of react violation
133+
"use no memo"; // TODO: Remover após corrigir a violação da regra do react
134134
// ...
135135
}
136136

137-
//Bad - no explanation
137+
//Ruim - sem explicação
138138
function Mystery() {
139139
"use no memo";
140140
// ...
141141
}
142142
```
143143

144-
### See also {/*see-also*/}
144+
### Veja também {/*see-also*/}
145145

146-
* [`"use memo"`](/reference/react-compiler/directives/use-memo) - Opt into compilation
147-
* [React Compiler](/learn/react-compiler) - Getting started guide
146+
* [`"use memo"`](/reference/react-compiler/directives/use-memo) - Optar pela compilação
147+
* [React Compiler](/learn/react-compiler) - Guia de primeiros passos

0 commit comments

Comments
 (0)