Skip to content

Commit 4500cb4

Browse files
natrodrigouilian
andauthored
Translation of the describing-the-ui page (#660)
* Translation of the describing-the-ui page * Update src/content/learn/describing-the-ui.md Co-authored-by: Uilian Souza <[email protected]> * Update src/content/learn/describing-the-ui.md Co-authored-by: Uilian Souza <[email protected]> * Update src/content/learn/describing-the-ui.md with reviews * Update src/content/learn/describing-the-ui.md * Fixed conflicting terms on src/content/learn/describing-the-ui.md --------- Co-authored-by: Uilian Souza <[email protected]>
1 parent 54059f6 commit 4500cb4

File tree

1 file changed

+49
-47
lines changed

1 file changed

+49
-47
lines changed

src/content/learn/describing-the-ui.md

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
---
2-
title: Describing the UI
2+
title: Construindo a UI
33
---
44

55
<Intro>
66

7-
React is a JavaScript library for rendering user interfaces (UI). UI is built from small units like buttons, text, and images. React lets you combine them into reusable, nestable *components.* From web sites to phone apps, everything on the screen can be broken down into components. In this chapter, you'll learn to create, customize, and conditionally display React components.
7+
React é uma biblioteca JavaScript para renderizar interfaces de usuário (UI). A interface do usuário é construída a partir de pequenas unidades, como botões, texto e imagens. O React permite combiná-los em *componentes.* encaixáveis ​​e reutilizáveis. De sites a aplicativos de telefone, tudo na tela pode ser dividido em componentes. Neste capítulo, você aprenderá a criar, personalizar e exibir componentes React condicionalmente.
88

99
</Intro>
1010

1111
<YouWillLearn isChapter={true}>
1212

13-
* [How to write your first React component](/learn/your-first-component)
14-
* [When and how to create multi-component files](/learn/importing-and-exporting-components)
15-
* [How to add markup to JavaScript with JSX](/learn/writing-markup-with-jsx)
16-
* [How to use curly braces with JSX to access JavaScript functionality from your components](/learn/javascript-in-jsx-with-curly-braces)
17-
* [How to configure components with props](/learn/passing-props-to-a-component)
18-
* [How to conditionally render components](/learn/conditional-rendering)
19-
* [How to render multiple components at a time](/learn/rendering-lists)
20-
* [How to avoid confusing bugs by keeping components pure](/learn/keeping-components-pure)
13+
* [Como criar seu primeiro componente React](/learn/your-first-component)
14+
* [Quando e como criar múltiplos componentes](/learn/importing-and-exporting-components)
15+
* [Como escrever tags dentro do JavaScript usando JSX](/learn/writing-markup-with-jsx)
16+
* [Como utilizar chaves no JSX para utilizar funcões JavaScript nos seus componentes](/learn/javascript-in-jsx-with-curly-braces)
17+
* [Como configurar componentes utilizando props(propriedades)](/learn/passing-props-to-a-component)
18+
* [Como renderizar componentes de forma condicional](/learn/conditional-rendering)
19+
* [Como renderizar múltiplos componentes de uma só vez](/learn/rendering-lists)
20+
* [Como evitar comportamentos inesperados mantendo seus componentes puros](/learn/keeping-components-pure)
2121

2222
</YouWillLearn>
2323

24-
## Your first component {/*your-first-component*/}
25-
26-
React applications are built from isolated pieces of UI called *components*. A React component is a JavaScript function that you can sprinkle with markup. Components can be as small as a button, or as large as an entire page. Here is a `Gallery` component rendering three `Profile` components:
24+
## Seu Primeiro Componente {/*your-first-component*/}
2725

26+
Aplicações React são construídas a partir de partes isoladas da UI chamadas de *componentes*. Um componente React é uma função JavaScript que você pode usar em combinação com tags. Os componentes podem ser tão pequenos quanto um botão ou tão grandes quanto uma página inteira. Abaixo você pode ver um componente `Gallery` renderizando três componentes `Profile`:
2827
<Sandpack>
2928

3029
```js
@@ -57,13 +56,13 @@ img { margin: 0 10px 10px 0; height: 90px; }
5756

5857
<LearnMore path="/learn/your-first-component">
5958

60-
Read **[Your First Component](/learn/your-first-component)** to learn how to declare and use React components.
59+
Leia **[Seu Primeiro Componente](/learn/your-first-component)** para aprender como criar e usar componentes React.
6160

6261
</LearnMore>
6362

64-
## Importing and exporting components {/*importing-and-exporting-components*/}
63+
## Importando e Exportando Componentes {/*importing-and-exporting-components*/}
6564

66-
You can declare many components in one file, but large files can get difficult to navigate. To solve this, you can *export* a component into its own file, and then *import* that component from another file:
65+
Você pode declarar vários componentes em um único arquivo, mas arquivos grandes podem ser difíceis de navegar. Para resolver isso, você pode *exportar* um componente para um arquivo separado, e então *importar* este componente em outro arquivo:
6766

6867

6968
<Sandpack>
@@ -112,22 +111,22 @@ img { margin: 0 10px 10px 0; }
112111

113112
<LearnMore path="/learn/importing-and-exporting-components">
114113

115-
Read **[Importing and Exporting Components](/learn/importing-and-exporting-components)** to learn how to split components into their own files.
114+
Leia **[Importando e Exportando Componentes](/learn/importing-and-exporting-components)** para aprender como separar seus componentes em arquivos próprios.
116115

117116
</LearnMore>
118117

119-
## Writing markup with JSX {/*writing-markup-with-jsx*/}
118+
## Escrevendo Tags com JSX {/*writing-markup-with-jsx*/}
120119

121-
Each React component is a JavaScript function that may contain some markup that React renders into the browser. React components use a syntax extension called JSX to represent that markup. JSX looks a lot like HTML, but it is a bit stricter and can display dynamic information.
120+
Cada componente React é uma função JavaScript que pode conter tags que o React renderiza no navegador. Componentes React utilizam uma extensão de sintaxe chamada JSX para representar essas tags. JSX parece muito com HTML, mas é um pouco mais rígido e pode exibir informações de forma dinâmica.
122121

123-
If we paste existing HTML markup into a React component, it won't always work:
122+
Nem sempre colar um HTML pré-existente irá funcionar em um componente React:
124123

125124
<Sandpack>
126125

127126
```js
128127
export default function TodoList() {
129128
return (
130-
// This doesn't quite work!
129+
// Isto não vai funcionar!
131130
<h1>Hedy Lamarr's Todos</h1>
132131
<img
133132
src="https://i.imgur.com/yXOvdOSs.jpg"
@@ -149,7 +148,7 @@ img { height: 90px; }
149148
150149
</Sandpack>
151150
152-
If you have existing HTML like this, you can fix it using a [converter](https://transform.tools/html-to-jsx):
151+
Você pode consertar seu HTML pré-existente usando um [conversor](https://transform.tools/html-to-jsx):
153152
154153
<Sandpack>
155154
@@ -181,13 +180,13 @@ img { height: 90px; }
181180

182181
<LearnMore path="/learn/writing-markup-with-jsx">
183182

184-
Read **[Writing Markup with JSX](/learn/writing-markup-with-jsx)** to learn how to write valid JSX.
183+
Leia **[Escrevendo Tags com JSX](/learn/writing-markup-with-jsx)** para aprender como escrever JSX corretamente.
185184

186185
</LearnMore>
187186

188-
## JavaScript in JSX with curly braces {/*javascript-in-jsx-with-curly-braces*/}
187+
## JavaScript entre Chaves no JSX {/*javascript-in-jsx-with-curly-braces*/}
189188

190-
JSX lets you write HTML-like markup inside a JavaScript file, keeping rendering logic and content in the same place. Sometimes you will want to add a little JavaScript logic or reference a dynamic property inside that markup. In this situation, you can use curly braces in your JSX to "open a window" to JavaScript:
189+
JSX permite que você escreva de maneira análoga ao HTML dentro de um arquivo JavaScript, mantendo a lógica de renderização e o conteúdo no mesmo lugar. Em alguns momentos, você pode querer adicionar alguma lógica JavaScript ou uma propriedade dinâmica em uma tag. Neste tipo de situação, você pode utilizar chaves no JSX para "abrir uma janela" que entenda JavaScript:
191190

192191
<Sandpack>
193192

@@ -229,13 +228,13 @@ body > div > div { padding: 20px; }
229228
230229
<LearnMore path="/learn/javascript-in-jsx-with-curly-braces">
231230
232-
Read **[JavaScript in JSX with Curly Braces](/learn/javascript-in-jsx-with-curly-braces)** to learn how to access JavaScript data from JSX.
231+
Leia **[JavaScript entre Chaves no JSX](/learn/javascript-in-jsx-with-curly-braces)** para aprender como acessar dados do seu código JavaScript a partir do JSX.
233232
234233
</LearnMore>
235234
236-
## Passing props to a component {/*passing-props-to-a-component*/}
235+
## Passando Props para um Componente {/*passing-props-to-a-component*/}
237236
238-
React components use *props* to communicate with each other. Every parent component can pass some information to its child components by giving them props. Props might remind you of HTML attributes, but you can pass any JavaScript value through them, including objects, arrays, functions, and even JSX!
237+
Componentes React utilizam *propriedades (props)* para se comunicarem entre si. Cada componente pai pode passar informações para seus componentes filhos por meio de props. Props lembram um pouco os atributos HTML, mas você pode passar qualquer valor que seja válido em JavaScript por meio delas, incluindo objetos, arrays, funções e até mesmo JSX!
239238
240239
<Sandpack>
241240
@@ -310,15 +309,16 @@ export function getImageUrl(person, size = 's') {
310309

311310
<LearnMore path="/learn/passing-props-to-a-component">
312311

313-
Read **[Passing Props to a Component](/learn/passing-props-to-a-component)** to learn how to pass and read props.
312+
Leia **[Passando Props para um Componente](/learn/passing-props-to-a-component)** para aprender como passar e ler props.
314313

315314
</LearnMore>
316315

317-
## Conditional rendering {/*conditional-rendering*/}
316+
## Renderização Condicional {/*conditional-rendering*/}
317+
318+
Frequentemente você vai precisar exibir diferentes conteúdos nos seus componentes de acordo com certas condições. No React, você pode renderizar JSX condicionalmente utilizando uma sintaxe parecida com JavaScript, que usa o comando `if`, e operadores lógicos `&&` e `? :`.
318319

319-
Your components will often need to display different things depending on different conditions. In React, you can conditionally render JSX using JavaScript syntax like `if` statements, `&&`, and `? :` operators.
320+
Neste exemplo, o operador JavaScript `&&` é utilizado para renderizar condicionalmente um marcação de 'concluído':
320321

321-
In this example, the JavaScript `&&` operator is used to conditionally render a checkmark:
322322

323323
<Sandpack>
324324

@@ -358,15 +358,16 @@ export default function PackingList() {
358358
359359
<LearnMore path="/learn/conditional-rendering">
360360
361-
Read **[Conditional Rendering](/learn/conditional-rendering)** to learn the different ways to render content conditionally.
361+
Leia **[Renderização Condicional](/learn/conditional-rendering)** para aprender diferentes maneiras de renderizar um conteúdo de forma condicional.
362362
363363
</LearnMore>
364364
365-
## Rendering lists {/*rendering-lists*/}
365+
## Renderizando Listas {/*rendering-lists*/}
366366
367-
You will often want to display multiple similar components from a collection of data. You can use JavaScript's `filter()` and `map()` with React to filter and transform your array of data into an array of components.
367+
Frequentemente você vai desejar exibir vários componentes similares a partir de uma lista de dados. Você pode utilizar as funções `filter()` e `map()` do JavaScript no React para filtrar e transformar suas listas de dados em listas de componentes.
368+
369+
Para cada item da lista, você precisa especificar uma chave (`key`). Normalmente é desejável que você use um ID do seu banco de dados como `key`. Chaves permitem que o React rastreie o local de cada item da lista, mesmo que a lista mude.
368370
369-
For each array item, you will need to specify a `key`. Usually, you will want to use an ID from the database as a `key`. Keys let React keep track of each item's place in the list even if the list changes.
370371
371372
<Sandpack>
372373
@@ -458,18 +459,19 @@ h2 { font-size: 20px; }
458459

459460
<LearnMore path="/learn/rendering-lists">
460461

461-
Read **[Rendering Lists](/learn/rendering-lists)** to learn how to render a list of components, and how to choose a key.
462+
Leia **[Renderizando Listas](/learn/rendering-lists)** para aprender como renderizar uma lista de compomentes e como escolher uma chave para cada item da lista.
462463

463464
</LearnMore>
464465

465-
## Keeping components pure {/*keeping-components-pure*/}
466+
## Mantendo Seus Componentes Puros {/*keeping-components-pure*/}
467+
468+
Algumas funções JavaScript são *puras*. Uma função pura:
466469

467-
Some JavaScript functions are *pure.* A pure function:
468470

469-
* **Minds its own business.** It does not change any objects or variables that existed before it was called.
470-
* **Same inputs, same output.** Given the same inputs, a pure function should always return the same result.
471+
* **Cuida apenas de suas próprias responsabilidades.** Isso significa que ela não modifica nenhum objeto ou variável que existia antes que ela fosse chamada.
472+
* **Mesmas entradas, mesma saída.** Dadas as mesmas entradas, uma função pura sempre deve retornar o mesmo resultado.
471473

472-
By strictly only writing your components as pure functions, you can avoid an entire class of baffling bugs and unpredictable behavior as your codebase grows. Here is an example of an impure component:
474+
Escrevendo apenas funções puras, você pode evitar muitos erros e comportamentos imprevisíveis conforme seu código aumenta. Este é um exemplo de componente impuro:
473475

474476
<Sandpack>
475477

@@ -495,7 +497,7 @@ export default function TeaSet() {
495497

496498
</Sandpack>
497499

498-
You can make this component pure by passing a prop instead of modifying a preexisting variable:
500+
Você pode tornar esse componente puro passando uma prop ao invés de modificar uma variável pré-existente:
499501

500502
<Sandpack>
501503

@@ -519,12 +521,12 @@ export default function TeaSet() {
519521

520522
<LearnMore path="/learn/keeping-components-pure">
521523

522-
Read **[Keeping Components Pure](/learn/keeping-components-pure)** to learn how to write components as pure, predictable functions.
524+
Leia **[Mantendo Seus Componentes Puros](/learn/keeping-components-pure)** para aprender como criar componentes puros e funções previsíveis.
523525

524526
</LearnMore>
525527

526-
## What's next? {/*whats-next*/}
528+
## O que vem depois? {/*whats-next*/}
527529

528-
Head over to [Your First Component](/learn/your-first-component) to start reading this chapter page by page!
530+
Navegue para a página [Seu Primeiro Componente](/learn/your-first-component) para começar a ler esse capítulo página por página!
529531

530-
Or, if you're already familiar with these topics, why not read about [Adding Interactivity](/learn/adding-interactivity)?
532+
Ou, se você já tem familirialidade com estes tópicos, por quê não ler sobre [Adicionando Interatividade](/learn/adding-interactivity)?

0 commit comments

Comments
 (0)