diff --git a/content/blog/2020-02-26-react-v16.13.0.md b/content/blog/2020-02-26-react-v16.13.0.md index a893093c8..eaa57df7c 100644 --- a/content/blog/2020-02-26-react-v16.13.0.md +++ b/content/blog/2020-02-26-react-v16.13.0.md @@ -5,25 +5,25 @@ redirect_from: - "blog/2020/03/02/react-v16.13.0.html" --- -Today we are releasing React 16.13.0. It contains bugfixes and new deprecation warnings to help prepare for a future major release. +Hoje estamos lançando o React 16.13.0. Ele contém correções de bugs e novos avisos de depreciação para ajudar a se preparar para uma futura versão principal. -## New Warnings {#new-warnings} +## Novos Avisos {#new-warnings} -### Warnings for some updates during render {#warnings-for-some-updates-during-render} +### Avisos para algumas atualizações durante a renderização {#warnings-for-some-updates-during-render} -A React component should not cause side effects in other components during rendering. +Um componente React não deve causar efeitos colaterais em outros componentes durante a renderização. -It is supported to call `setState` during render, but [only for *the same component*](/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops). If you call `setState` during a render on a different component, you will now see a warning: +É suportado chamar `setState` durante a renderização, mas [somente para *o mesmo componente*](/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops). Se você chamar `setState` durante uma renderização em um componente diferente, você verá um aviso: ``` Warning: Cannot update a component from inside the function body of a different component. ``` -**This warning will help you find application bugs caused by unintentional state changes.** In the rare case that you intentionally want to change the state of another component as a result of rendering, you can wrap the `setState` call into `useEffect`. +**Este aviso ajudará a encontrar erros de aplicativos causados ​​por alterações não intencionais do estado.** Nos raros casos em que você deseja alterar intencionalmente o estado de outro componente como resultado da renderização, é possível agrupar a chamada do `setState` dentro do `useEffect`. -### Warnings for conflicting style rules +### Avisos para regras de estilo conflitantes -When dynamically applying a `style` that contains longhand and shorthand versions of CSS properties, particular combinations of updates can cause inconsistent styling. For example: +Ao aplicar dinamicamente um `style` que contém versões *longhand* e *shorthand* de propriedades CSS, combinações específicas de atualizações podem causar estilos inconsistentes. Por exemplo: ```js
``` -You might expect this `
` to always have a red background, no matter the value of `toggle`. However, on alternating the value of `toggle` between `true` and `false`, the background color start as `red`, then alternates between `transparent` and `blue`, [as you can see in this demo](https://codesandbox.io/s/suspicious-sunset-g3jub). +Você pode esperar que essa `
` tenha sempre um fundo vermelho, não importa o valor de `toggle`. No entanto, ao alternar o valor de `toggle` entre `true` e `false`, a cor de fundo começa como `red`, então alterna entre `transparent` e `blue`, [como você pode ver nessa demo](https://codesandbox.io/s/suspicious-sunset-g3jub). -**React now detects conflicting style rules and logs a warning.** To fix the issue, don't mix shorthand and longhand versions of the same CSS property in the `style` prop. +**O React agora detecta regras de estilo conflitantes e registra um aviso.** Para corrigir um problema, não misture versões *shorthand* e *longhand* da mesma propriedade CSS na prop `style`. -### Warnings for some deprecated string refs {#warnings-for-some-deprecated-string-refs} +### Avisos para algumas string refs depreciadas {#warnings-for-some-deprecated-string-refs} -[String Refs is an old legacy API](/docs/refs-and-the-dom.html#legacy-api-string-refs) which is discouraged and is going to be deprecated in the future: +[String Refs é uma API legada](/docs/refs-and-the-dom.html#legacy-api-string-refs) que é desencorajada e será depreciada no futuro: ```js