Skip to content

Commit ca87fb9

Browse files
docs: translate error-boundaries.md to Português (Brasil) (#1211)
Co-authored-by: translate-react-bot[bot] <251169733+translate-react-bot[bot]@users.noreply.github.com>
1 parent 190aa80 commit ca87fb9

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@ title: error-boundaries
44

55
<Intro>
66

7-
Validates usage of Error Boundaries instead of try/catch for errors in child components.
7+
Valida o uso de Limites de Erro em vez de try/catch para erros em componentes filhos.
88

99
</Intro>
1010

11-
## Rule Details {/*rule-details*/}
11+
## Detalhes da Regra {/*rule-details*/}
1212

13-
Try/catch blocks can't catch errors that happen during React's rendering process. Errors thrown in rendering methods or hooks bubble up through the component tree. Only [Error Boundaries](/reference/react/Component#catching-rendering-errors-with-an-error-boundary) can catch these errors.
13+
Blocos try/catch não podem capturar erros que ocorrem durante o processo de renderização do React. Erros lançados em métodos de renderização ou hooks sobem pela árvore de componentes. Apenas [Limites de Erro](/reference/react/Component#catching-rendering-errors-with-an-error-boundary) podem capturar esses erros.
1414

15-
### Invalid {/*invalid*/}
15+
### Inválido {/*invalid*/}
1616

17-
Examples of incorrect code for this rule:
17+
Exemplos de código incorreto para esta regra:
1818

1919
```js {expectedErrors: {'react-compiler': [4]}}
20-
// ❌ Try/catch won't catch render errors
20+
// ❌ Try/catch não capturará erros de renderização
2121
function Parent() {
2222
try {
23-
return <ChildComponent />; // If this throws, catch won't help
23+
return <ChildComponent />; // Se isso lançar um erro, o catch não ajudará
2424
} catch (error) {
25-
return <div>Error occurred</div>;
25+
return <div>Ocorreu um erro</div>;
2626
}
2727
}
2828
```
2929

30-
### Valid {/*valid*/}
30+
### Válido {/*valid*/}
3131

32-
Examples of correct code for this rule:
32+
Exemplos de código correto para esta regra:
3333

3434
```js
35-
//Using error boundary
35+
//Usando limite de erro
3636
function Parent() {
3737
return (
3838
<ErrorBoundary>
@@ -42,28 +42,28 @@ function Parent() {
4242
}
4343
```
4444

45-
## Troubleshooting {/*troubleshooting*/}
45+
## Solução de Problemas {/*troubleshooting*/}
4646

47-
### Why is the linter telling me not to wrap `use` in `try`/`catch`? {/*why-is-the-linter-telling-me-not-to-wrap-use-in-trycatch*/}
47+
### Por que o linter está me dizendo para não envolver `use` em `try`/`catch`? {/*why-is-the-linter-telling-me-not-to-wrap-use-in-trycatch*/}
4848

49-
The `use` hook doesn't throw errors in the traditional sense, it suspends component execution. When `use` encounters a pending promise, it suspends the component and lets React show a fallback. Only Suspense and Error Boundaries can handle these cases. The linter warns against `try`/`catch` around `use` to prevent confusion as the `catch` block would never run.
49+
O hook `use` não lança erros no sentido tradicional, ele suspende a execução do componente. Quando `use` encontra uma promessa pendente, ele suspende o componente e permite que o React mostre um fallback. Apenas Suspense e Limites de Erro podem lidar com esses casos. O linter adverte contra `try`/`catch` em torno de `use` para evitar confusão, pois o bloco `catch` nunca seria executado.
5050

5151
```js {expectedErrors: {'react-compiler': [5]}}
52-
// ❌ Try/catch around `use` hook
52+
// ❌ Try/catch em torno do hook `use`
5353
function Component({promise}) {
5454
try {
55-
const data = use(promise); // Won't catch - `use` suspends, not throws
55+
const data = use(promise); // Não captura - `use` suspende, não lança erro
5656
return <div>{data}</div>;
5757
} catch (error) {
58-
return <div>Failed to load</div>; // Unreachable
58+
return <div>Falha ao carregar</div>; // Inalcançável
5959
}
6060
}
6161

62-
//Error boundary catches `use` errors
62+
//Limite de erro captura erros de `use`
6363
function App() {
6464
return (
65-
<ErrorBoundary fallback={<div>Failed to load</div>}>
66-
<Suspense fallback={<div>Loading...</div>}>
65+
<ErrorBoundary fallback={<div>Falha ao carregar</div>}>
66+
<Suspense fallback={<div>Carregando...</div>}>
6767
<DataComponent promise={fetchData()} />
6868
</Suspense>
6969
</ErrorBoundary>

0 commit comments

Comments
 (0)