Skip to content

Commit dbd115d

Browse files
docs: translate use-no-memo.md to Português (Brasil) (#1163)
1 parent 1c11d71 commit dbd115d

1 file changed

Lines changed: 48 additions & 49 deletions

File tree

src/content/reference/react-compiler/directives/use-no-memo.md

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22
title: "use no memo"
33
titleForTitleTag: "'use no memo' directive"
44
---
5-
65
<Intro>
76

8-
`"use no memo"` prevents a function from being optimized by React Compiler.
7+
`"use no memo"` impede que uma função seja otimizada pelo React Compiler.
98

109
</Intro>
1110

1211
<InlineToc />
1312

1413
---
1514

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

1817
### `"use no memo"` {/*use-no-memo*/}
1918

20-
Add `"use no memo"` at the beginning of a function to prevent React Compiler optimization.
19+
Adicione `"use no memo"` no início de uma função para impedir a otimização pelo React Compiler.
2120

2221
```js {1}
2322
function MyComponent() {
@@ -26,122 +25,122 @@ function MyComponent() {
2625
}
2726
```
2827

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.
28+
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 temporária ao depurar ou ao lidar com código que não funciona corretamente com o compilador.
3029

31-
#### Caveats {/*caveats*/}
30+
#### Ressalvas {/*caveats*/}
3231

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.
32+
* `"use no memo"` deve estar no início do corpo da função, antes de quaisquer imports ou outro código (comentários são permitidos).
33+
* A diretiva deve ser escrita com aspas duplas ou simples, não com crases.
34+
* A diretiva deve corresponder exatamente a `"use no memo"` ou seu alias `"use no forget"`.
35+
* Esta diretiva tem precedência sobre todos os modos de compilação e outras diretivas.
36+
* Destina-se a ser uma ferramenta de depuração temporária, não uma solução permanente.
3837

39-
### How `"use no memo"` opts-out of optimization {/*how-use-no-memo-opts-out*/}
38+
### Como `"use no memo"` desabilita a otimização {/*how-use-no-memo-opts-out*/}
4039

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.
40+
O React Compiler analisa seu código em tempo de compilação para aplicar otimizações. `"use no memo"` cria um limite explícito que instrui o compilador a ignorar uma função inteiramente.
4241

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
42+
Esta diretiva tem precedência sobre todas as outras configurações:
43+
* No modo `all`: A função é ignorada apesar da configuração global
44+
* No modo `infer`: A função é ignorada mesmo que heurísticas a otimizassem
4645

47-
The compiler treats these functions as if the React Compiler wasn't enabled, leaving them exactly as written.
46+
O compilador trata essas funções como se o React Compiler não estivesse habilitado, deixando-as exatamente como escritas.
4847

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

51-
`"use no memo"` should be used sparingly and temporarily. Common scenarios include:
50+
`"use no memo"` deve ser usado com moderação e temporariamente. Cenários comuns incluem:
5251

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

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

60-
// Rules of React violations that weren't statically detected
59+
// Violações das Regras do React que não foram detectadas estaticamente
6160
// ...
6261
}
6362
```
6463

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

6867
```js
6968
function ThirdPartyWrapper() {
7069
"use no memo";
7170

72-
useThirdPartyHook(); // Has side effects that compiler might optimize incorrectly
71+
useThirdPartyHook(); // Tem efeitos colaterais que o compilador pode otimizar incorretamente
7372
// ...
7473
}
7574
```
7675

7776
---
7877

79-
## Usage {/*usage*/}
78+
## Uso {/*usage*/}
8079

81-
The `"use no memo"` directive is placed at the beginning of a function body to prevent React Compiler from optimizing that function:
80+
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:
8281

8382
```js
8483
function MyComponent() {
8584
"use no memo";
86-
// Function body
85+
// Corpo da função
8786
}
8887
```
8988

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

9291
```js
9392
"use no memo";
9493

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

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

10099
---
101100

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

104-
### Directive not preventing compilation {/*not-preventing*/}
103+
### Diretiva não impede a compilação {/*not-preventing*/}
105104

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

108107
```js
109-
//Wrong - directive after code
108+
//Errado - diretiva após o código
110109
function Component() {
111110
const data = getData();
112-
"use no memo"; // Too late!
111+
"use no memo"; // Tarde demais!
113112
}
114113

115-
//Correct - directive first
114+
//Correto - diretiva primeiro
116115
function Component() {
117116
"use no memo";
118117
const data = getData();
119118
}
120119
```
121120

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

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

128-
**Always document why** you're disabling optimization:
127+
**Sempre documente o motivo** pelo qual você está desabilitando a otimização:
129128

130129
```js
131-
//Good - clear explanation and tracking
130+
//Bom - explicação clara e rastreamento
132131
function DataProcessor() {
133-
"use no memo"; // TODO: Remove after fixing rule of react violation
132+
"use no memo"; // TODO: Remover após corrigir a violação da regra do React
134133
// ...
135134
}
136135

137-
//Bad - no explanation
136+
//Ruim - sem explicação
138137
function Mystery() {
139138
"use no memo";
140139
// ...
141140
}
142141
```
143142

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

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

0 commit comments

Comments
 (0)