Skip to content

Commit 7d784ef

Browse files
pecraveirorick-ssa
andauthored
Translate Optional Content: Warnings (#767)
* Tradução de Conteúdo opcional: Warnings * Update src/content/warnings/invalid-aria-prop.md Alterações solicitadas pelo @rick-ssa via PR. Co-authored-by: Ricardo Santos da Silva <[email protected]> * Update src/content/warnings/invalid-aria-prop.md Alterações solicitadas pelo @rick-ssa via PR. Co-authored-by: Ricardo Santos da Silva <[email protected]> * Update src/content/warnings/invalid-hook-call-warning.md Alterações solicitadas pelo @rick-ssa via PR. Co-authored-by: Ricardo Santos da Silva <[email protected]> * Update src/content/warnings/invalid-hook-call-warning.md Alterações solicitadas pelo @rick-ssa via PR. Co-authored-by: Ricardo Santos da Silva <[email protected]> * Update src/content/warnings/invalid-hook-call-warning.md Alterações solicitadas pelo @rick-ssa via PR. Co-authored-by: Ricardo Santos da Silva <[email protected]> * Modificaçoes solicitadas por @Zapotoczn --------- Co-authored-by: Ricardo Santos da Silva <[email protected]>
1 parent 034a591 commit 7d784ef

File tree

6 files changed

+88
-88
lines changed

6 files changed

+88
-88
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Invalid ARIA Prop Warning
2+
title: Aviso de Propriedade ARIA Inválida
33
---
44

5-
This warning will fire if you attempt to render a DOM element with an `aria-*` prop that does not exist in the Web Accessibility Initiative (WAI) Accessible Rich Internet Application (ARIA) [specification](https://www.w3.org/TR/wai-aria-1.1/#states_and_properties).
5+
Este aviso será disparado se você tentar renderizar um elemento DOM com uma propriedade `aria-*` que não existe na [especificação] (https://www.w3.org/TR/wai-aria-1.1/#states_and_properties) da Web Accessibility Initiative (WAI) Accessible Rich Internet Application (ARIA).
66

7-
1. If you feel that you are using a valid prop, check the spelling carefully. `aria-labelledby` and `aria-activedescendant` are often misspelled.
7+
1. Se você acredita que está usando uma propriedade válida, verifique a ortografia cuidadosamente. `aria-labelledby` e `aria-activedescendant` são frequentemente escritas de forma incorreta.
88

9-
2. If you wrote `aria-role`, you may have meant `role`.
9+
2. Se você escreveu `aria-role`, talvez tenha pretendido dizer `role`.
1010

11-
3. Otherwise, if you're on the latest version of React DOM and verified that you're using a valid property name listed in the ARIA specification, please [report a bug](https://github.com/facebook/react/issues/new/choose).
11+
3. Caso contrário, se você estiver na versão mais recente do React DOM e verificou que está usando um nome de propriedade válido listado na especificação ARIA, por favor, [relate um erro](https://github.com/facebook/react/issues/new/choose).
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
---
2-
title: Rules of Hooks
2+
title: Regras dos Hooks
33
---
44

5-
You are probably here because you got the following error message:
5+
Provavelmente você está aqui porque recebeu a seguinte mensagem de erro:
66

77
<ConsoleBlock level="error">
88

9-
Hooks can only be called inside the body of a function component.
9+
Hooks só podem ser chamados dentro do corpo de um componente de função.
1010

1111
</ConsoleBlock>
1212

13-
There are three common reasons you might be seeing it:
13+
Existem três razões comuns pelas quais você pode estar vendo isso:
1414

15-
1. You might be **breaking the Rules of Hooks**.
16-
2. You might have **mismatching versions** of React and React DOM.
17-
3. You might have **more than one copy of React** in the same app.
15+
1. Você pode estar **quebrando as Regras dos Hooks**.
16+
2. Você pode ter **versões incompatíveis** do React e do React DOM.
17+
3. Você pode ter **mais de uma cópia do React** no mesmo aplicativo.
1818

19-
Let's look at each of these cases.
19+
Vamos analisar cada um desses casos.
2020

21-
## Breaking Rules of Hooks {/*breaking-rules-of-hooks*/}
21+
## Quebrando as Regras dos Hooks {/*breaking-rules-of-hooks*/}
2222

23-
Functions whose names start with `use` are called [*Hooks*](/reference/react) in React.
23+
Funções cujos nomes começam com `use` são chamadas de [*Hooks*](/reference/react) no React.
2424

25-
**Don’t call Hooks inside loops, conditions, or nested functions.** Instead, always use Hooks at the top level of your React function, before any early returns. You can only call Hooks while React is rendering a function component:
25+
**Não chame Hooks dentro de loops, condições ou funções aninhadas.** Em vez disso, sempre use Hooks no nível superior da sua função de componente React, antes de qualquer retorno antecipado. Você só pode chamar Hooks enquanto o React está renderizando um componente de função:
2626

27-
*Call them at the top level in the body of a [function component](/learn/your-first-component).
28-
*Call them at the top level in the body of a [custom Hook](/learn/reusing-logic-with-custom-hooks).
27+
*Chame-os no nível superior no corpo de um [componente de função](/learn/your-first-component).
28+
*Chame-os no nível superior no corpo de um [Hook personalizado](/learn/reusing-logic-with-custom-hooks).
2929

3030
```js{2-3,8-9}
3131
function Counter() {
32-
// ✅ Good: top-level in a function component
32+
// ✅ Bom: no nível superior em um componente de função
3333
const [count, setCount] = useState(0);
3434
// ...
3535
}
3636
3737
function useWindowWidth() {
38-
// ✅ Good: top-level in a custom Hook
38+
// ✅ Bom: no nível superior em um Hook personalizado
3939
const [width, setWidth] = useState(window.innerWidth);
4040
// ...
4141
}
4242
```
4343

44-
It’s **not** supported to call Hooks (functions starting with `use`) in any other cases, for example:
44+
**Não** é suportado chamar Hooks (funções começando com `use`) em outros casos, por exemplo:
4545

46-
* 🔴 Do not call Hooks inside conditions or loops.
47-
* 🔴 Do not call Hooks after a conditional `return` statement.
48-
* 🔴 Do not call Hooks in event handlers.
49-
* 🔴 Do not call Hooks in class components.
50-
* 🔴 Do not call Hooks inside functions passed to `useMemo`, `useReducer`, or `useEffect`.
46+
* 🔴 Não chame Hooks dentro de condições ou loops.
47+
* 🔴 Não chame Hooks após uma instrução de `return` condicional.
48+
* 🔴 Não chame Hooks em manipuladores de eventos.
49+
* 🔴 Não chame Hooks em componentes de classe.
50+
* 🔴 Não chame Hooks dentro de funções passadas para `useMemo`, `useReducer`, ou `useEffect`.
5151

52-
If you break these rules, you might see this error.
52+
Se você quebrar essas regras, poderá ver esse erro.
5353

5454
```js{3-4,11-12,20-21}
5555
function Bad({ cond }) {
5656
if (cond) {
57-
// 🔴 Bad: inside a condition (to fix, move it outside!)
57+
// 🔴 Ruim: dentro de uma condição (para corrigir, mova para fora!)
5858
const theme = useContext(ThemeContext);
5959
}
6060
// ...
6161
}
6262
6363
function Bad() {
6464
for (let i = 0; i < 10; i++) {
65-
// 🔴 Bad: inside a loop (to fix, move it outside!)
65+
// 🔴 Ruim: dentro de um loop (para corrigir, mova para fora!)
6666
const theme = useContext(ThemeContext);
6767
}
6868
// ...
@@ -72,22 +72,22 @@ function Bad({ cond }) {
7272
if (cond) {
7373
return;
7474
}
75-
// 🔴 Bad: after a conditional return (to fix, move it before the return!)
75+
// 🔴 Ruim: após um retorno condicional (para corrigir, mova para antes do retorno!)
7676
const theme = useContext(ThemeContext);
7777
// ...
7878
}
7979
8080
function Bad() {
8181
function handleClick() {
82-
// 🔴 Bad: inside an event handler (to fix, move it outside!)
82+
// 🔴 Ruim: dentro de um manipulador de eventos (para corrigir, mova para fora!)
8383
const theme = useContext(ThemeContext);
8484
}
8585
// ...
8686
}
8787
8888
function Bad() {
8989
const style = useMemo(() => {
90-
// 🔴 Bad: inside useMemo (to fix, move it outside!)
90+
// 🔴 Ruim: dentro de useMemo (para corrigir, mova para fora!)
9191
const theme = useContext(ThemeContext);
9292
return createStyle(theme);
9393
});
@@ -96,63 +96,63 @@ function Bad() {
9696
9797
class Bad extends React.Component {
9898
render() {
99-
// 🔴 Bad: inside a class component (to fix, write a function component instead of a class!)
99+
// 🔴 Ruim: dentro de um componente de classe (para corrigir, escreva um componente de função em vez de uma classe!)
100100
useEffect(() => {})
101101
// ...
102102
}
103103
}
104104
```
105105

106-
You can use the [`eslint-plugin-react-hooks` plugin](https://www.npmjs.com/package/eslint-plugin-react-hooks) to catch these mistakes.
106+
Você pode usar o [plugin `eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) para detectar esses erros.
107107

108108
<Note>
109109

110-
[Custom Hooks](/learn/reusing-logic-with-custom-hooks) *may* call other Hooks (that's their whole purpose). This works because custom Hooks are also supposed to only be called while a function component is rendering.
110+
[Hooks personalizados](/learn/reusing-logic-with-custom-hooks) *podem* chamar outros Hooks (essa é a finalidade deles). Isso funciona porque Hooks personalizados também devem ser chamados apenas enquanto um componente de função está sendo renderizado.
111111

112112
</Note>
113113

114-
## Mismatching Versions of React and React DOM {/*mismatching-versions-of-react-and-react-dom*/}
114+
## Versões Incompatíveis do React e React DOM {/*mismatching-versions-of-react-and-react-dom*/}
115115

116-
You might be using a version of `react-dom` (< 16.8.0) or `react-native` (< 0.59) that doesn't yet support Hooks. You can run `npm ls react-dom` or `npm ls react-native` in your application folder to check which version you're using. If you find more than one of them, this might also create problems (more on that below).
116+
Você pode estar usando uma versão do `react-dom` (< 16.8.0) ou `react-native` (< 0.59) que ainda não suporta Hooks. Você pode executar `npm ls react-dom` ou `npm ls react-native` na pasta do seu aplicativo para verificar qual versão está usando. Se encontrar mais de uma, isso também pode criar problemas (mais sobre isso abaixo).
117117

118-
## Duplicate React {/*duplicate-react*/}
118+
## Cópia Duplicada do React {/*duplicate-react*/}
119119

120-
In order for Hooks to work, the `react` import from your application code needs to resolve to the same module as the `react` import from inside the `react-dom` package.
120+
Para que os Hooks funcionem, a importação de `react` no código da sua aplicação precisa ser resolvida para o mesmo módulo que a importação de `react` dentro do pacote `react-dom`.
121121

122-
If these `react` imports resolve to two different exports objects, you will see this warning. This may happen if you **accidentally end up with two copies** of the `react` package.
122+
Se essas importações de `react` forem resolvidas para dois objetos de exportação diferentes, você verá este aviso. Isso pode acontecer se você **acidentalmente acabar com duas cópias** do pacote `react`.
123123

124-
If you use Node for package management, you can run this check in your project folder:
124+
Se você usar Node para gerenciamento de pacotes, pode executar esta verificação na sua pasta de projeto:
125125

126126
<TerminalBlock>
127127

128128
npm ls react
129129

130130
</TerminalBlock>
131131

132-
If you see more than one React, you'll need to figure out why this happens and fix your dependency tree. For example, maybe a library you're using incorrectly specifies `react` as a dependency (rather than a peer dependency). Until that library is fixed, [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/) is one possible workaround.
132+
Se você ver mais de um React, precisará descobrir por que isso acontece e corrigir sua árvore de dependências. Por exemplo, talvez uma biblioteca que você está usando especifica incorretamente `react` como uma dependência (em vez de uma dependência peer). Até que essa biblioteca seja corrigida, [resoluções do Yarn](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/) são uma possível solução alternativa.
133133

134-
You can also try to debug this problem by adding some logs and restarting your development server:
134+
Você também pode tentar depurar este problema adicionando alguns logs e reiniciando seu servidor de desenvolvimento:
135135

136136
```js
137-
// Add this in node_modules/react-dom/index.js
137+
// Adicione isso em node_modules/react-dom/index.js
138138
window.React1 = require('react');
139139

140-
// Add this in your component file
140+
// Adicione isso no seu arquivo de componente
141141
require('react-dom');
142142
window.React2 = require('react');
143143
console.log(window.React1 === window.React2);
144144
```
145145

146-
If it prints `false` then you might have two Reacts and need to figure out why that happened. [This issue](https://github.com/facebook/react/issues/13991) includes some common reasons encountered by the community.
146+
Se imprimir `false` então você pode ter dois Reacts e precisa descobrir por que isso aconteceu. [Este problema](https://github.com/facebook/react/issues/13991) inclui algumas razões comuns encontradas pela comunidade.
147147

148-
This problem can also come up when you use `npm link` or an equivalent. In that case, your bundler might "see" two Reacts — one in application folder and one in your library folder. Assuming `myapp` and `mylib` are sibling folders, one possible fix is to run `npm link ../myapp/node_modules/react` from `mylib`. This should make the library use the application's React copy.
148+
Esse problema também pode ocorrer quando você usa `npm link` ou equivalente. Nesse caso, seu bundler pode "ver" dois Reacts — um na pasta da aplicação e outro na pasta da sua biblioteca. Supondo que `myapp` e `mylib` sejam pastas irmãs, uma possível correção é executar `npm link ../myapp/node_modules/react` a partir de `mylib`. Isso deve fazer com que a biblioteca use a cópia do React da aplicação.
149149

150150
<Note>
151151

152-
In general, React supports using multiple independent copies on one page (for example, if an app and a third-party widget both use it). It only breaks if `require('react')` resolves differently between the component and the `react-dom` copy it was rendered with.
152+
Em geral, o React suporta o uso de várias cópias independentes em uma página (por exemplo, se um aplicativo e um widget de terceiros usarem). Ele só quebra se `require('react')` for resolvido de maneira diferente entre o componente e a cópia do `react-dom` com a qual foi renderizado.
153153

154154
</Note>
155155

156-
## Other Causes {/*other-causes*/}
156+
## Outras Causas {/*other-causes*/}
157157

158-
If none of this worked, please comment in [this issue](https://github.com/facebook/react/issues/13991) and we'll try to help. Try to create a small reproducing example — you might discover the problem as you're doing it.
158+
Se nada disso funcionou, por favor comente neste [problema](https://github.com/facebook/react/issues/13991) e tentaremos ajudar. Tente criar um pequeno exemplo reproduzível — você pode descobrir o problema enquanto faz isso.

src/content/warnings/react-dom-test-utils.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
---
2-
title: react-dom/test-utils Deprecation Warnings
2+
title: Avisos de Depreciação do react-dom/test-utils
33
---
44

5-
## ReactDOMTestUtils.act() warning {/*reactdomtestutilsact-warning*/}
5+
## Aviso do ReactDOMTestUtils.act() {/*reactdomtestutilsact-warning*/}
66

7-
`act` from `react-dom/test-utils` has been deprecated in favor of `act` from `react`.
7+
O `act` de `react-dom/test-utils` foi depreciado em favor do `act` do `react`.
88

9-
Before:
9+
Antes:
1010

1111
```js
1212
import {act} from 'react-dom/test-utils';
1313
```
1414

15-
After:
15+
Depois:
1616

1717
```js
1818
import {act} from 'react';
1919
```
2020

21-
## Rest of ReactDOMTestUtils APIS {/*rest-of-reactdomtestutils-apis*/}
21+
## Resto das APIs do ReactDOMTestUtils {/*rest-of-reactdomtestutils-apis*/}
2222

23-
All APIs except `act` have been removed.
23+
Todas as APIs, exceto `act`, foram removidas.
2424

25-
The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) for a modern and well supported testing experience.
25+
A equipe do React recomenda migrar seus testes para [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) para uma experiência de teste moderna e bem suportada.
2626

2727
### ReactDOMTestUtils.renderIntoDocument {/*reactdomtestutilsrenderintodocument*/}
2828

29-
`renderIntoDocument` can be replaced with `render` from `@testing-library/react`.
29+
O `renderIntoDocument` pode ser substituído por `render` de `@testing-library/react`.
3030

31-
Before:
31+
Antes:
3232

3333
```js
3434
import {renderIntoDocument} from 'react-dom/test-utils';
3535

3636
renderIntoDocument(<Component />);
3737
```
3838

39-
After:
39+
Depois:
4040

4141
```js
4242
import {render} from '@testing-library/react';
@@ -46,9 +46,9 @@ render(<Component />);
4646

4747
### ReactDOMTestUtils.Simulate {/*reactdomtestutilssimulate*/}
4848

49-
`Simulate` can be replaced with `fireEvent` from `@testing-library/react`.
49+
`Simulate` pode ser substituído por `fireEvent` de `@testing-library/react`.
5050

51-
Before:
51+
Antes:
5252

5353
```js
5454
import {Simulate} from 'react-dom/test-utils';
@@ -57,7 +57,7 @@ const element = document.querySelector('button');
5757
Simulate.click(element);
5858
```
5959

60-
After:
60+
Depois:
6161

6262
```js
6363
import {fireEvent} from '@testing-library/react';
@@ -66,9 +66,9 @@ const element = document.querySelector('button');
6666
fireEvent.click(element);
6767
```
6868

69-
Be aware that `fireEvent` dispatches an actual event on the element and doesn't just synthetically call the event handler.
69+
Esteja ciente de que `fireEvent` dispara um evento real no elemento e não apenas chama sinteticamente o manipulador de eventos.
7070

71-
### List of all removed APIs {/*list-of-all-removed-apis-list-of-all-removed-apis*/}
71+
### Lista de todas as APIs removidas {/*list-of-all-removed-apis-list-of-all-removed-apis*/}
7272

7373
- `mockComponent()`
7474
- `isElement()`
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: react-test-renderer Deprecation Warnings
2+
title: Avisos de Depreciação do react-test-renderer
33
---
44

5-
## ReactTestRenderer.create() warning {/*reacttestrenderercreate-warning*/}
5+
## Aviso do ReactTestRenderer.create() {/*reacttestrenderercreate-warning*/}
66

7-
react-test-renderer is deprecated. A warning will fire whenever calling ReactTestRenderer.create() or ReactShallowRender.render(). The react-test-renderer package will remain available on NPM but will not be maintained and may break with new React features or changes to React's internals.
7+
O react-test-renderer está descontinuado. Um aviso será emitido sempre que ReactTestRenderer.create() ou ReactShallowRender.render() forem chamados. O pacote react-test-renderer permanecerá disponível no NPM, mas não será mantido e pode quebrar com novos recursos do React ou mudanças nos internos do React.
88

9-
The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience.
9+
A equipe do React recomenda migrar seus testes para [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) ou [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) para uma experiência de teste moderna e bem suportada.
1010

1111

12-
## new ShallowRenderer() warning {/*new-shallowrenderer-warning*/}
12+
## Novo Aviso do ShallowRenderer() {/*new-shallowrenderer-warning*/}
1313

14-
The react-test-renderer package no longer exports a shallow renderer at `react-test-renderer/shallow`. This was simply a repackaging of a previously extracted separate package: `react-shallow-renderer`. Therefore you can continue using the shallow renderer in the same way by installing it directly. See [Github](https://github.com/enzymejs/react-shallow-renderer) / [NPM](https://www.npmjs.com/package/react-shallow-renderer).
14+
O pacote react-test-renderer não exporta mais um shallow renderer em `react-test-renderer/shallow`. . Isto era simplesmente uma reembalagem de um pacote separado anteriormente extraído: `react-shallow-renderer`. Portanto, você pode continuar usando o shallow renderer da mesma maneira, instalando-o diretamente. Veja [Github](https://github.com/enzymejs/react-shallow-renderer) / [NPM](https://www.npmjs.com/package/react-shallow-renderer).
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Special Props Warning
2+
title: Aviso sobre Props Especiais
33
---
44

5-
Most props on a JSX element are passed on to the component, however, there are two special props (`ref` and `key`) which are used by React, and are thus not forwarded to the component.
5+
A maioria das props em um elemento JSX são passadas para o componente, no entanto, há duas props especiais (`ref` and `key`) que são usadas pelo React e, portanto, não são encaminhadas para o componente.
66

7-
For instance, you can't read `props.key` from a component. If you need to access the same value within the child component, you should pass it as a different prop (ex: `<ListItemWrapper key={result.id} id={result.id} />` and read `props.id`). While this may seem redundant, it's important to separate app logic from hints to React.
7+
Por exemplo, você não pode ler `props.key` de um componente. Se você precisar acessar o mesmo valor dentro do componente filho, deve passá-lo como uma prop diferente (ex: `<ListItemWrapper key={result.id} id={result.id} />` e ler `props.id`). Embora isso possa parecer redundante, é importante separar a lógica da aplicação das dicas para o React.

0 commit comments

Comments
 (0)