Skip to content

Commit c2bfec4

Browse files
committed
terminada a tradução
1 parent 148c1f7 commit c2bfec4

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/content/reference/react-dom/client/hydrateRoot.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ O React se recupera de alguns erros de hidratação, mas **você precisa corrig
201201
202202
---
203203
204-
### Hydrating an entire document {/*hydrating-an-entire-document*/}
204+
### Hidratando um documento inteiro {/*hydrating-an-entire-document*/}
205205
206-
Apps fully built with React can render the entire document as JSX, including the [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html) tag:
206+
Aplicações totalmente construídas com React podem renderizar o documento inteiro como JSX, incluindo o [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html) tag:
207207
208208
```js {3,13}
209209
function App() {
@@ -223,7 +223,7 @@ function App() {
223223
}
224224
```
225225
226-
To hydrate the entire document, pass the [`document`](https://developer.mozilla.org/en-US/docs/Web/API/Window/document) global as the first argument to `hydrateRoot`:
226+
Para hidratar o documento inteiro, passe o [`document`](https://developer.mozilla.org/en-US/docs/Web/API/Window/document) global como primeiro argumento para `hydrateRoot`:
227227
228228
```js {4}
229229
import { hydrateRoot } from 'react-dom/client';
@@ -234,11 +234,11 @@ hydrateRoot(document, <App />);
234234
235235
---
236236
237-
### Suppressing unavoidable hydration mismatch errors {/*suppressing-unavoidable-hydration-mismatch-errors*/}
237+
### Suprimindo erros inevitáveis ​​de incompatibilidade de hidratação {/*suppressing-unavoidable-hydration-mismatch-errors*/}
238238
239-
If a single element’s attribute or text content is unavoidably different between the server and the client (for example, a timestamp), you may silence the hydration mismatch warning.
239+
Se um simples atributo do elemento ou conteúdo de texto inevitavelmente conter diferenças entre o servidor e o cliente (por examplo, um timestamp), você poderá silenciar o aviso de diferença de hidratação.
240240
241-
To silence hydration warnings on an element, add `suppressHydrationWarning={true}`:
241+
Para silenciar avisos de hidratação em um elemento, adicione `suppressHydrationWarning={true}`:
242242
243243
<Sandpack>
244244
@@ -270,13 +270,13 @@ export default function App() {
270270
271271
</Sandpack>
272272
273-
This only works one level deep, and is intended to be an escape hatch. Don’t overuse it. Unless it’s text content, React still won’t attempt to patch it up, so it may remain inconsistent until future updates.
273+
Somente funciona em um nível de profundidade, e é para ser usado como uma saída de emergência. Não abuse desse recurso. A menos que seja conteúdo de texto, o React ainda não tentará corrigi-lo, portanto pode permanecer inconsistente até atualizações futuras.
274274
275275
---
276276
277-
### Handling different client and server content {/*handling-different-client-and-server-content*/}
277+
### Tratando diferenças de conteúdo entre cliente e servidor {/*handling-different-client-and-server-content*/}
278278
279-
If you intentionally need to render something different on the server and the client, you can do a two-pass rendering. Components that render something different on the client can read a [state variable](/reference/react/useState) like `isClient`, which you can set to `true` in an [Effect](/reference/react/useEffect):
279+
Se você intecionalmente precisa renderizar algo diferente no servidor e no cliente, você pode fazer uma renderização de dois passos. Componentes que renderizam algo diferente no cliente pode ler um [state variable](/reference/react/useState) como `isClient`, o qual você pode definir como `true` em um [Effect](/reference/react/useEffect):
280280
281281
<Sandpack>
282282
@@ -316,21 +316,21 @@ export default function App() {
316316
317317
</Sandpack>
318318
319-
This way the initial render pass will render the same content as the server, avoiding mismatches, but an additional pass will happen synchronously right after hydration.
319+
Dessa forma a renderização inicial passará a renderizar o mesmo conteúdo do servidor, evitando diferenças, mas um passo adicional acontecerá de forma síncrona logo após a hidratação.
320320
321321
<Pitfall>
322322
323-
This approach makes hydration slower because your components have to render twice. Be mindful of the user experience on slow connections. The JavaScript code may load significantly later than the initial HTML render, so rendering a different UI immediately after hydration may also feel jarring to the user.
323+
Essa abordagem deixa a hidratação mais vagarosa porque seus componentes terão que renderizar duas vezes. Fique atento a experiência do usuário com conexões lentas. O código JavaScript pode atrasar significantemente seu carregamento comparado com a renderização inicial do HTML, então renderizar uma UI diferente imediatamente após hidratação pode também ser prejudicial para o usuário.
324324
325325
</Pitfall>
326326
327327
---
328328
329-
### Updating a hydrated root component {/*updating-a-hydrated-root-component*/}
329+
### Atualizando um componente raiz hidratado {/*updating-a-hydrated-root-component*/}
330330
331-
After the root has finished hydrating, you can call [`root.render`](#root-render) to update the root React component. **Unlike with [`createRoot`](/reference/react-dom/client/createRoot), you don't usually need to do this because the initial content was already rendered as HTML.**
331+
Após a finalização da hidratação da raiz, você pode chamar [`root.render`](#root-render) para atualizar o componente raiz do React. **Diferente de [`createRoot`](/reference/react-dom/client/createRoot), você não precisa frequentemente fazer isso porque o conteúdo inicial já renderizou como HTML.**
332332
333-
If you call `root.render` at some point after hydration, and the component tree structure matches up with what was previously rendered, React will [preserve the state.](/learn/preserving-and-resetting-state) Notice how you can type in the input, which means that the updates from repeated `render` calls every second in this example are not destructive:
333+
Se você chamar `root.render` em algum ponto após a hidratação, e a estrutura do componente árvore coincidir com o que foi previamente renderizado, o React [preservará o state.](/learn/preserving-and-resetting-state) Note como você pode escrever no campo de texto, o que significa que a atualização de repetidos `render` chamados cada segundo nesse exemplo não são destrutivos:
334334
335335
<Sandpack>
336336
@@ -372,17 +372,17 @@ export default function App({counter}) {
372372
373373
</Sandpack>
374374
375-
It is uncommon to call [`root.render`](#root-render) on a hydrated root. Usually, you'll [update state](/reference/react/useState) inside one of the components instead.
375+
É incomum chamar [`root.render`](#root-render) para uma raiz hidratada. Ao invés disso, usualmente, você [atualizará o state](/reference/react/useState) dentro de um dos componentes.
376376
377-
### Show a dialog for uncaught errors {/*show-a-dialog-for-uncaught-errors*/}
377+
### Mostrando diálogo para erros não interceptados {/*show-a-dialog-for-uncaught-errors*/}
378378
379379
<Canary>
380380
381-
`onUncaughtError` is only available in the latest React Canary release.
381+
`onUncaughtError` só está disponível no último release do React Canary.
382382
383383
</Canary>
384384
385-
By default, React will log all uncaught errors to the console. To implement your own error reporting, you can provide the optional `onUncaughtError` root option:
385+
Por padrão, React imprimirá todos os log's de erros não interceptados no console. Para implementar seu prórpio relatório de erros, você pode definir o opcional `onUncaughtError` para raiz:
386386
387387
```js [[1, 7, "onUncaughtError"], [2, 7, "error", 1], [3, 7, "errorInfo"], [4, 11, "componentStack"]]
388388
import { hydrateRoot } from 'react-dom/client';
@@ -403,12 +403,12 @@ const root = hydrateRoot(
403403
root.render(<App />);
404404
```
405405
406-
The <CodeStep step={1}>onUncaughtError</CodeStep> option is a function called with two arguments:
406+
A opção <CodeStep step={1}>onUncaughtError</CodeStep> é uma função que é chamada com dois argumentos:
407407
408-
1. The <CodeStep step={2}>error</CodeStep> that was thrown.
409-
2. An <CodeStep step={3}>errorInfo</CodeStep> object that contains the <CodeStep step={4}>componentStack</CodeStep> of the error.
408+
1. O <CodeStep step={2}>error</CodeStep> que é lançado.
409+
2. um objeto <CodeStep step={3}>errorInfo</CodeStep> que contém o <CodeStep step={4}>componentStack</CodeStep> do erro.
410410
411-
You can use the `onUncaughtError` root option to display error dialogs:
411+
Você pode usar a opção de raiz `onUncaughtError` para exibir diálogos de erros:
412412
413413
<Sandpack>
414414
@@ -626,15 +626,15 @@ export default function App() {
626626
</Sandpack>
627627
628628
629-
### Displaying Error Boundary errors {/*displaying-error-boundary-errors*/}
629+
### Mostrando erros de Error Boundary {/*displaying-error-boundary-errors*/}
630630
631631
<Canary>
632632
633-
`onCaughtError` is only available in the latest React Canary release.
633+
`onCaughtError` só está disponível na última release do React Canary.
634634
635635
</Canary>
636636
637-
By default, React will log all errors caught by an Error Boundary to `console.error`. To override this behavior, you can provide the optional `onCaughtError` root option for errors caught by an [Error Boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary):
637+
Por padrão, React impriirá todos os log's de erros interceptados por um Error Boundary no `console.error`. Para mudar esse comportmento, você pode definir o opcional `onCaughtError` opção de raiz para erros interceptados por [Error Boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary):
638638
639639
```js [[1, 7, "onCaughtError"], [2, 7, "error", 1], [3, 7, "errorInfo"], [4, 11, "componentStack"]]
640640
import { hydrateRoot } from 'react-dom/client';
@@ -655,12 +655,12 @@ const root = hydrateRoot(
655655
root.render(<App />);
656656
```
657657
658-
The <CodeStep step={1}>onCaughtError</CodeStep> option is a function called with two arguments:
658+
A opção <CodeStep step={1}>onCaughtError</CodeStep> é uma função que possui dois argumentos:
659659
660-
1. The <CodeStep step={2}>error</CodeStep> that was caught by the boundary.
661-
2. An <CodeStep step={3}>errorInfo</CodeStep> object that contains the <CodeStep step={4}>componentStack</CodeStep> of the error.
660+
1. O <CodeStep step={2}>error</CodeStep> que foi interceptado pelo boundary.
661+
2. um objeto <CodeStep step={3}>errorInfo</CodeStep> que contém o <CodeStep step={4}>componentStack</CodeStep> do erro.
662662
663-
You can use the `onCaughtError` root option to display error dialogs or filter known errors from logging:
663+
Você pode usar a opção da raiz `onCaughtError` para mostrar diálogos de erro ou filtrar erros conhecidos do log:
664664
665665
<Sandpack>
666666
@@ -913,9 +913,9 @@ function Throw({error}) {
913913
914914
</Sandpack>
915915
916-
### Show a dialog for recoverable hydration mismatch errors {/*show-a-dialog-for-recoverable-hydration-mismatch-errors*/}
916+
### Mostrar um diálogo para erros recuperáveis de diferença de hidratação {/*show-a-dialog-for-recoverable-hydration-mismatch-errors*/}
917917
918-
When React encounters a hydration mismatch, it will automatically attempt to recover by rendering on the client. By default, React will log hydration mismatch errors to `console.error`. To override this behavior, you can provide the optional `onRecoverableError` root option:
918+
Quando o React encontra uma diferença de hidratação, ele automaticamente tentará recuperar renderizando no cliente. Por padrão, o React imprimirá o log de erros de diferença de hidratação no `console.error`. Para mudar esse comportamento, você pode definir o opcional `onRecoverableError` opção da raiz:
919919
920920
```js [[1, 7, "onRecoverableError"], [2, 7, "error", 1], [3, 11, "error.cause", 1], [4, 7, "errorInfo"], [5, 12, "componentStack"]]
921921
import { hydrateRoot } from 'react-dom/client';
@@ -936,12 +936,12 @@ const root = hydrateRoot(
936936
);
937937
```
938938
939-
The <CodeStep step={1}>onRecoverableError</CodeStep> option is a function called with two arguments:
939+
A opção <CodeStep step={1}>onRecoverableError</CodeStep> é uma função com dois argumentos:
940940
941-
1. The <CodeStep step={2}>error</CodeStep> React throws. Some errors may include the original cause as <CodeStep step={3}>error.cause</CodeStep>.
942-
2. An <CodeStep step={4}>errorInfo</CodeStep> object that contains the <CodeStep step={5}>componentStack</CodeStep> of the error.
941+
1. O <CodeStep step={2}>error</CodeStep> lançado pelo React. Alguns erros podem incluir a causa original como <CodeStep step={3}>error.cause</CodeStep>.
942+
2. Um objeto <CodeStep step={4}>errorInfo</CodeStep> que contém o <CodeStep step={5}>componentStack</CodeStep> do erro.
943943
944-
You can use the `onRecoverableError` root option to display error dialogs for hydration mismatches:
944+
Você pode usar a opção da raiz `onRecoverableError` para mostrar diálogos de erro para diferenças de hidratação:
945945
946946
<Sandpack>
947947
@@ -1175,20 +1175,20 @@ function Throw({error}) {
11751175
11761176
</Sandpack>
11771177
1178-
## Troubleshooting {/*troubleshooting*/}
1178+
## Solução de problemas {/*troubleshooting*/}
11791179
11801180
1181-
### I'm getting an error: "You passed a second argument to root.render" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/}
1181+
### Estou recebendo esse erro: "You passed a second argument to root.render" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/}
11821182
1183-
A common mistake is to pass the options for `hydrateRoot` to `root.render(...)`:
1183+
um erro comum é passar as opções de `hydrateRoot` para `root.render(...)`:
11841184
11851185
<ConsoleBlock level="error">
11861186
11871187
Warning: You passed a second argument to root.render(...) but it only accepts one argument.
11881188
11891189
</ConsoleBlock>
11901190
1191-
To fix, pass the root options to `hydrateRoot(...)`, not `root.render(...)`:
1191+
Para correção, passe as opções da raiz para `hydrateRoot(...)`, e não para `root.render(...)`:
11921192
```js {2,5}
11931193
// 🚩 Wrong: root.render only takes one argument.
11941194
root.render(App, {onUncaughtError});

0 commit comments

Comments
 (0)