Skip to content

Commit 423afb2

Browse files
committed
translating pages/reference/render.md to pt-br
1 parent 9798fdf commit 423afb2

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

beta/src/pages/reference/render.md

+39-39
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: render()
44

55
<Intro>
66

7-
`render` renders a piece of [JSX](/learn/writing-markup-with-jsx) ("React element") into a browser DOM container node. It instructs React to change the DOM inside of the `container` so that it matches the passed JSX.
7+
`render` renderiza um [JSX](/learn/writing-markup-with-jsx) ("elemento React") em um nó de contêiner DOM do navegador. Ele instrui o React a alterar o DOM dentro do `container` para que ele corresponda ao JSX que foi passado.
88

99
```js
1010
render(<App />, container);
@@ -13,21 +13,21 @@ render(<App />, container, callback);
1313

1414
</Intro>
1515

16-
## Rendering the root component {/*rendering-the-root-component*/}
16+
## Renderizando o componente *root* {/*rendering-the-root-component*/}
1717

18-
To call `render`, you need a piece of JSX and a DOM container:
18+
Para chamar `render`, você precisa de um JSX e um contêiner DOM:
1919

2020
<APIAnatomy>
2121

2222
<AnatomyStep title="React element">
2323

24-
The UI you want to render.
24+
A UI que você deseja renderizar.
2525

2626
</AnatomyStep>
2727

2828
<AnatomyStep title="DOM container">
2929

30-
The DOM node you want to render your UI into. The container itself isn’t modified, only its children are.
30+
O nó do DOM no qual você deseja renderizar sua UI. O contêiner em si não é modificado, apenas seus filhos são.
3131

3232
</AnatomyStep>
3333

@@ -38,7 +38,7 @@ render(<App />, container);
3838

3939
</APIAnatomy>
4040

41-
In apps fully built with React, you will do this once at the top level of your app--to render the "root" component.
41+
Em aplicativos totalmente construídos com React, você fará isso uma vez no nível superior do seu aplicativo - para renderizar o componente "root".
4242

4343
<Sandpack>
4444

@@ -52,50 +52,50 @@ render(<App />, document.getElementById('root'));
5252

5353
```js App.js
5454
export default function App() {
55-
return <h1>Hello, world!</h1>;
55+
return <h1>Olá, mundo!</h1>;
5656
}
5757
```
5858

5959
</Sandpack>
6060

6161
<br />
6262

63-
## Rendering multiple roots {/*rendering-multiple-roots*/}
63+
## Renderizando vários *root* {/*rendering-multiple-roots*/}
6464

65-
If you use ["sprinkles"](/learn/add-react-to-a-website) of React here and there, call `render` for each top-level piece of UI managed by React.
65+
Se você usar ["pedaços"](/learn/add-react-to-a-website) do React aqui e ali, chame `render` para cada parte de nível superior da UI gerenciada pelo React.
6666

6767
<Sandpack>
6868

6969
```html public/index.html
70-
<nav id="navigation"></nav>
70+
<nav id="navegacao"></nav>
7171
<main>
72-
<p>This paragraph is not rendered by React (open index.html to verify).</p>
73-
<section id="comments"></section>
72+
<p>Este parágrafo não é renderizado pelo React (abra index.html para verificar).</p>
73+
<section id="comentarios"></section>
7474
</main>
7575
```
7676

7777
```js index.js active
7878
import './styles.css';
7979
import { render } from 'react-dom';
80-
import { Comments, Navigation } from './Components.js';
80+
import { Comentarios, Navegacao } from './Components.js';
8181

8282
render(
83-
<Navigation />,
84-
document.getElementById('navigation')
83+
<Navegacao />,
84+
document.getElementById('navegacao')
8585
);
8686

8787
render(
88-
<Comments />,
89-
document.getElementById('comments')
88+
<Comentarios />,
89+
document.getElementById('comentarios')
9090
);
9191
```
9292

9393
```js Components.js
94-
export function Navigation() {
94+
export function Navegacao() {
9595
return (
9696
<ul>
9797
<NavLink href="/">Home</NavLink>
98-
<NavLink href="/about">About</NavLink>
98+
<NavLink href="/sobre">Sobre</NavLink>
9999
</ul>
100100
);
101101
}
@@ -108,19 +108,19 @@ function NavLink({ href, children }) {
108108
);
109109
}
110110

111-
export function Comments() {
111+
export function Comentarios() {
112112
return (
113113
<>
114-
<h2>Comments</h2>
115-
<Comment text="Hello!" author="Sophie" />
116-
<Comment text="How are you?" author="Sunil" />
114+
<h2>Comentarios</h2>
115+
<Comentario texto="Olá!" autor="Sophie" />
116+
<Comentario texto="Como vai você?" autor="Sunil" />
117117
</>
118118
);
119119
}
120120

121-
function Comment({ text, author }) {
121+
function Comentario({ texto, autor }) {
122122
return (
123-
<p>{text} — <i>{author}</i></p>
123+
<p>{texto} — <i>{autor}</i></p>
124124
);
125125
}
126126
```
@@ -134,9 +134,9 @@ nav ul li { display: inline-block; margin-right: 20px; }
134134

135135
<br />
136136

137-
## Updating the rendered tree {/*updating-the-rendered-tree*/}
137+
## Atualizando a árvore renderizada {/*updating-the-rendered-tree*/}
138138

139-
You can call `render` more than once on the same DOM node. As long as 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:
139+
Você pode chamar `render` mais de uma vez no mesmo nó do DOM. Contanto que a estrutura da árvore de componentes corresponda ao que foi renderizado anteriormente, o React [preservará o estado](/learn/preserving-and-resetting-state). Observe como você pode digitar a entrada:
140140

141141
<Sandpack>
142142

@@ -147,42 +147,42 @@ import App from './App.js';
147147
let i = 0;
148148
setInterval(() => {
149149
render(
150-
<App counter={i} />,
150+
<App contador={i} />,
151151
document.getElementById('root')
152152
);
153153
i++;
154154
}, 1000);
155155
```
156156

157157
```js App.js
158-
export default function App({counter}) {
158+
export default function App({contador}) {
159159
return (
160160
<>
161-
<h1>Hello, world! {counter}</h1>
162-
<input placeholder="Type something here" />
161+
<h1>Olá, mundo! {contador}</h1>
162+
<input placeholder="Digite algo aqui!" />
163163
</>
164164
);
165165
}
166166
```
167167

168168
</Sandpack>
169169

170-
You can destroy the rendered tree with [`unmountComponentAtNode()`](TODO).
170+
Você pode destruir a árvore renderizada com [`unmountComponentAtNode()`](TODO).
171171

172172
<br />
173173

174-
## When not to use it {/*when-not-to-use-it*/}
174+
## Quando não usar {/*when-not-to-use-it*/}
175175

176-
* If your app uses server rendering and generates HTML on the server, use [`hydrate`](TODO) instead of `render`.
177-
* If your app is fully built with React, you shouldn't need to use `render` more than once. If you want to render something in a different part of the DOM tree (for example, a modal or a tooltip), use [`createPortal`](TODO) instead.
176+
* Se seu aplicativo usa renderização de servidor (SSR) e gera HTML no servidor, use [`hydrate`](TODO) em vez de `render`.
177+
* Se seu aplicativo for totalmente construído com React, você não precisará usar `render` mais de uma vez. Se você quiser renderizar algo em uma parte diferente da árvore DOM (por exemplo, um modal ou uma dica de ferramenta), use [`createPortal`](TODO).
178178

179179
<br />
180180

181181

182-
## Behavior in detail {/*behavior-in-detail*/}
182+
## Comportamento em detalhes {/*behavior-in-detail*/}
183183

184-
The first time you call `render`, any existing DOM elements inside `container` are replaced. If you call `render` again, React will update the DOM as necessary to reflect the latest JSX. React will decide which parts of the DOM can be reused and which need to be recreated by ["matching it up"](/learn/preserving-and-resetting-state) with the previously rendered tree. Calling `render` repeatedly is similar to calling `setState`--in both cases, React avoids unnecessary DOM updates.
184+
Na primeira vez que você chama `render`, todos os elementos DOM existentes dentro de `container` são substituídos. Se você chamar `render` novamente, o React atualizará o DOM conforme necessário para refletir o JSX mais recente. O React decidirá quais partes do DOM podem ser reutilizadas e quais precisam ser recriadas ["combinando"](/learn/preserving-and-resetting-state) com a árvore renderizada anteriormente. Chamar `render` repetidamente é semelhante a chamar `setState` -- em ambos os casos, o React evita atualizações desnecessárias do DOM.
185185

186-
You can pass a callback as the third argument. React will call it after your component is in the DOM.
186+
Você pode passar um *callback* como o terceiro argumento. O React irá chamá-lo depois que seu componente estiver no DOM.
187187

188-
If you render `<MyComponent />`, and `MyComponent` is a class component, `render` will return the instance of that class. In all other cases, it will return `null`.
188+
Se você renderizar `<MyComponent />`, e `MyComponent` for um componente de classe, `render` retornará a instância dessa classe. Em todos os outros casos, retornará `null`.

0 commit comments

Comments
 (0)