Skip to content

Commit 2f9a45c

Browse files
committed
[WIP] docs: translate understanding your ui as a tree
1 parent 3e413dd commit 2f9a45c

File tree

1 file changed

+45
-40
lines changed

1 file changed

+45
-40
lines changed

src/content/learn/understanding-your-ui-as-a-tree.md

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
---
2-
title: Understanding Your UI as a Tree
2+
title: Memahami UI Anda sebagai Pohon
33
---
44

55
<Intro>
66

7-
Your React app is taking shape with many components being nested within each other. How does React keep track of your app's component structure?
7+
Aplikasi React Anda mulai terbentuk dengan banyak komponen yang dirangkai satu sama lain. Bagaimana cara React melacak struktur komponen aplikasi Anda?
88

9-
React, and many other UI libraries, model UI as a tree. Thinking of your app as a tree is useful for understanding the relationship between components. This understanding will help you debug future concepts like performance and state management.
9+
React, dan banyak library UI lainnya, memodelkan UI sebagai sebuah pohon. Memikirkan aplikasi Anda sebagai sebuah pohon sangat berguna untuk memahami hubungan antar komponen. Pemahaman ini akan membantu Anda men-*debug* konsep-konsep di masa depan seperti kinerja dan manajemen *state*.
1010

1111
</Intro>
1212

1313
<YouWillLearn>
1414

15-
* How React "sees" component structures
16-
* What a render tree is and what it is useful for
17-
* What a module dependency tree is and what it is useful for
15+
* Bagaimana React "melihat" struktur komponen
16+
* Apa itu pohon *render* dan kegunaannya
17+
* Apa itu pohon modul dependensi dan kegunaannya
1818

1919
</YouWillLearn>
2020

21-
## Your UI as a tree {/*your-ui-as-a-tree*/}
21+
## UI Anda sebagai pohon {/*your-ui-as-a-tree*/}
2222

23-
Trees are a relationship model between items and UI is often represented using tree structures. For example, browsers use tree structures to model HTML ([DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model/Introduction)) and CSS ([CSSOM](https://developer.mozilla.org/docs/Web/API/CSS_Object_Model)). Mobile platforms also use trees to represent their view hierarchy.
23+
Pohon adalah model hubungan antara setiap bagian (*item*) dan UI yang sering direpresentasikan dengan menggunakan struktur pohon. Sebagai contoh, Peramban (*browser*) menggunakan struktur pohon untuk memodelkan HTML ([DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model/Introduction)) dan CSS ([CSSOM](https://developer.mozilla.org/docs/Web/API/CSS_Object_Model)). Platform seluler (*mobile*) juga menggunakan pohon untuk merepresentasikan hierarki tampilan mereka.
2424

25-
<Diagram name="preserving_state_dom_tree" height={193} width={864} alt="Diagram with three sections arranged horizontally. In the first section, there are three rectangles stacked vertically, with labels 'Component A', 'Component B', and 'Component C'. Transitioning to the next pane is an arrow with the React logo on top labeled 'React'. The middle section contains a tree of components, with the root labeled 'A' and two children labeled 'B' and 'C'. The next section is again transitioned using an arrow with the React logo on top labeled 'React DOM'. The third and final section is a wireframe of a browser, containing a tree of 8 nodes, which has only a subset highlighted (indicating the subtree from the middle section).">
25+
<Diagram name="preserving_state_dom_tree" height={193} width={864} alt="Diagram dengan tiga bagian yang disusun secara horizontal. Pada bagian pertama, terdapat tiga persegi panjang yang ditumpuk secara vertikal, dengan label 'Komponen A', 'Komponen B', dan 'Komponen C'. Transisi ke panel berikutnya adalah sebuah panah dengan logo React di bagian atas yang berlabel 'React'. Bagian tengah berisi sebuah pohon komponen, dengan root berlabel 'A' dan dua komponen berlabel 'B' dan 'C'. Bagian selanjutnya ditransisikan lagi menggunakan panah dengan logo React di bagian atas berlabel 'React DOM'. Bagian ketiga dan terakhir adalah wireframe dari sebuah peramban, yang berisi sebuah pohon dengan 8 *node*, yang hanya memiliki sebuah bagian yang disorot (mengindikasikan subpohon dari bagian tengah).">
2626

27-
React creates a UI tree from your components. In this example, the UI tree is then used to render to the DOM.
27+
React membuat sebuah pohon UI dari komponen-komponen Anda. Pada contoh ini, pohon UI kemudian digunakan untuk me-*render* ke DOM.
2828
</Diagram>
2929

30-
Like browsers and mobile platforms, React also uses tree structures to manage and model the relationship between components in a React app. These trees are useful tools to understand how data flows through a React app and how to optimize rendering and app size.
30+
Seperti halnya peramban (*browser*) dan perangkat seluler (*mobile*) bergerak, React juga menggunakan struktur pohon untuk mengelola dan memodelkan hubungan antar komponen dalam aplikasi React. Pohon-pohon ini adalah alat yang berguna untuk memahami bagaimana data mengalir melalui aplikasi React dan bagaimana mengoptimalkan *rendering* dan ukuran aplikasi.
3131

32-
## The Render Tree {/*the-render-tree*/}
32+
## Pohon *Render* {/*the-render-tree*/}
3333

34-
A major feature of components is the ability to compose components of other components. As we [nest components](/learn/your-first-component#nesting-and-organizing-components), we have the concept of parent and child components, where each parent component may itself be a child of another component.
34+
Fitur utama dari komponen adalah kemampuan untuk menyusun komponen dari komponen lain. Saat kita [menyusun komponen](/learn/
35+
your-first-component#nesting-and-organizing-components)
36+
, kita memiliki konsep komponen induk dan anak, di mana setiap komponen induk dapat menjadi anak dari komponen lain.
3537

36-
When we render a React app, we can model this relationship in a tree, known as the render tree.
38+
Ketika kita me-*render* aplikasi React, kita dapat memodelkan hubungan ini dalam sebuah pohon, yang dikenal sebagai pohon *render*.
3739

38-
Here is a React app that renders inspirational quotes.
40+
Berikut ini adalah aplikasi React yang membuat kutipan-kutipan inspiratif.
3941

4042
<Sandpack>
4143

@@ -47,7 +49,7 @@ import Copyright from './Copyright';
4749
export default function App() {
4850
return (
4951
<>
50-
<FancyText title text="Get Inspired App" />
52+
<FancyText title text="Aplikasi Dapatkan Inspirasi" />
5153
<InspirationGenerator>
5254
<Copyright year={2004} />
5355
</InspirationGenerator>
@@ -77,9 +79,9 @@ export default function InspirationGenerator({children}) {
7779

7880
return (
7981
<>
80-
<p>Your inspirational quote is:</p>
82+
<p>Kutipan inspiratif Anda adalah:</p>
8183
<FancyText text={quote} />
82-
<button onClick={next}>Inspire me again</button>
84+
<button onClick={next}>Berikan Aku inspirasi lagi.</button>
8385
{children}
8486
</>
8587
);
@@ -94,9 +96,9 @@ export default function Copyright({year}) {
9496

9597
```js src/quotes.js
9698
export default [
97-
"Don’t let yesterday take up too much of today.” — Will Rogers",
98-
"Ambition is putting a ladder against the sky.",
99-
"A joy that's shared is a joy made double.",
99+
"Jangan biarkan hari kemarin menyita terlalu banyak waktu di hari ini.” — Will Rogers",
100+
"Ambisi adalah menyusun tangga menuju langit.",
101+
"Kegembiraan yang dibagi adalah kegembiraan yang berlipat ganda.",
100102
];
101103
```
102104

@@ -118,34 +120,36 @@ export default [
118120

119121
</Sandpack>
120122

121-
<Diagram name="render_tree" height={250} width={500} alt="Tree graph with five nodes. Each node represents a component. The root of the tree is App, with two arrows extending from it to 'InspirationGenerator' and 'FancyText'. The arrows are labelled with the word 'renders'. 'InspirationGenerator' node also has two arrows pointing to nodes 'FancyText' and 'Copyright'.">
123+
<Diagram name="render_tree" height={250} width={500} alt="Graf pohon dengan lima simpul. Tiap simpul merepresentasikan sebuah komponen. Akar dari pohon ini adalah App, dengan dua anak panah yang memanjang dari akar tersebut ke 'InspirationGenerator' dan 'FancyText'. Panah-panah tersebut diberi label dengan kata 'render'. Node 'InspirationGenerator' juga memiliki dua anak panah yang mengarah ke node 'FancyText' dan 'Copyright'.
124+
">
122125

123-
React creates a *render tree*, a UI tree, composed of the rendered components.
126+
React membuat sebuah *render tree*, sebuah pohon UI, yang terdiri dari komponen-komponen yang di-*render*.
124127

125128

126129
</Diagram>
127130

128-
From the example app, we can construct the above render tree.
131+
Dari contoh aplikasi, kita dapat membuat pohon *render* di atas.
129132

130-
The tree is composed of nodes, each of which represents a component. `App`, `FancyText`, `Copyright`, to name a few, are all nodes in our tree.
133+
Pohon ini terdiri dari beberapa simpul, yang masing-masing mewakili sebuah komponen. `App`, `FancyText`, `Copyright`, dan beberapa lainnya, merupakan beberapa simpul di dalam pohon kita.
131134

132-
The root node in a React render tree is the [root component](/learn/importing-and-exporting-components#the-root-component-file) of the app. In this case, the root component is `App` and it is the first component React renders. Each arrow in the tree points from a parent component to a child component.
135+
Simpul akar (*root node*) dalam pohon *render* React adalah [root component](/learn/importing-and-exporting-components#the-root-component-file) dari aplikasi. Dalam kasus ini, Akar komponen adalah `Aplikasi` dan merupakan komponen pertama yang di-*render* oleh React. Setiap panah pada pohon menunjuk dari komponen induk ke komponen anak.
133136

134137
<DeepDive>
135138

136-
#### Where are the HTML tags in the render tree? {/*where-are-the-html-elements-in-the-render-tree*/}
139+
#### Di mana letak dari tag HTML dalam pohon *render*?
140+
{/*where-are-the-html-elements-in-the-render-tree*/}
137141

138-
You'll notice in the above render tree, there is no mention of the HTML tags that each component renders. This is because the render tree is only composed of React [components](learn/your-first-component#components-ui-building-blocks).
142+
Anda akan melihat pada pohon *render* di atas, tidak disebutkan tag HTML yang di-*render* oleh setiap komponen. Hal ini dikarenakan pohon *render* hanya terdiri dari React [components](learn/your-first-component#components-ui-building-blocks).
139143

140-
React, as a UI framework, is platform agnostic. On react.dev, we showcase examples that render to the web, which uses HTML markup as its UI primitives. But a React app could just as likely render to a mobile or desktop platform, which may use different UI primitives like [UIView](https://developer.apple.com/documentation/uikit/uiview) or [FrameworkElement](https://learn.microsoft.com/en-us/dotnet/api/system.windows.frameworkelement?view=windowsdesktop-7.0).
144+
React, sebagai sebuah framework UI, bersifat agnostik terhadap platform. Di react.dev, kami menampilkan contoh-contoh yang di-*render* ke web, yang menggunakan markup HTML sebagai primitif UI-nya. Tetapi aplikasi React bisa saja merender ke platform mobile atau desktop, yang mungkin menggunakan primitif UI yang berbeda seperti [UIView](https://developer.apple.com/documentation/uikit/uiview) atau [FrameworkElement](https://learn.microsoft.com/en-us/dotnet/api/system.windows.frameworkelement?view=windowsdesktop-7.0).
141145

142-
These platform UI primitives are not a part of React. React render trees can provide insight to our React app regardless of what platform your app renders to.
146+
Primitif UI platform ini bukan merupakan bagian dari React. Pohon *render* React dapat memberikan wawasan kepada aplikasi React kita terlepas dari platform apa aplikasi Anda di-*render*.
143147

144148
</DeepDive>
145149

146-
A render tree represents a single render pass of a React application. With [conditional rendering](/learn/conditional-rendering), a parent component may render different children depending on the data passed.
150+
Sebuah pohon *render* merepresentasikan sekali *render* pada aplikasi React. Dengan [perenderan kondisional](/learn/conditional-rendering), komponen induk dapat me-*render* anak yang berbeda tergantung pada data yang di-*render*.
147151

148-
We can update the app to conditionally render either an inspirational quote or color.
152+
Kita dapat memperbarui aplikasi untuk me-*render* secara bersyarat sebuah kutipan inspiratif atau warna.
149153

150154
<Sandpack>
151155

@@ -157,7 +161,7 @@ import Copyright from './Copyright';
157161
export default function App() {
158162
return (
159163
<>
160-
<FancyText title text="Get Inspired App" />
164+
<FancyText title text="Aplikasi Dapatkan Inspirasi" />
161165
<InspirationGenerator>
162166
<Copyright year={2004} />
163167
</InspirationGenerator>
@@ -194,12 +198,12 @@ export default function InspirationGenerator({children}) {
194198

195199
return (
196200
<>
197-
<p>Your inspirational {inspiration.type} is:</p>
201+
<p>{inspiration.type} inspiratif Anda adalah:</p>
198202
{inspiration.type === 'quote'
199203
? <FancyText text={inspiration.value} />
200204
: <Color value={inspiration.value} />}
201205

202-
<button onClick={next}>Inspire me again</button>
206+
<button onClick={next}>Berikan Aku inspirasi lagi</button>
203207
{children}
204208
</>
205209
);
@@ -214,11 +218,11 @@ export default function Copyright({year}) {
214218

215219
```js src/inspirations.js
216220
export default [
217-
{type: 'quote', value: "Don’t let yesterday take up too much of today.” — Will Rogers"},
221+
{type: 'quote', value: "Jangan biarkan hari kemarin menyita terlalu banyak waktu di hari ini.” — Will Rogers"},
218222
{type: 'color', value: "#B73636"},
219-
{type: 'quote', value: "Ambition is putting a ladder against the sky."},
223+
{type: 'quote', value: "Ambisi adalah menyusun tangga menuju langit."},
220224
{type: 'color', value: "#256266"},
221-
{type: 'quote', value: "A joy that's shared is a joy made double."},
225+
{type: 'quote', value: "Kegembiraan yang dibagi adalah kegembiraan yang berlipat ganda."},
222226
{type: 'color', value: "#F9F2B4"},
223227
];
224228
```
@@ -245,9 +249,10 @@ export default [
245249
```
246250
</Sandpack>
247251

248-
<Diagram name="conditional_render_tree" height={250} width={561} alt="Tree graph with six nodes. The top node of the tree is labelled 'App' with two arrows extending to nodes labelled 'InspirationGenerator' and 'FancyText'. The arrows are solid lines and are labelled with the word 'renders'. 'InspirationGenerator' node also has three arrows. The arrows to nodes 'FancyText' and 'Color' are dashed and labelled with 'renders?'. The last arrow points to the node labelled 'Copyright' and is solid and labelled with 'renders'.">
252+
<Diagram name="conditional_render_tree" height={250} width={561} alt="Graf pohon dengan enam simpul. Simpul teratas dari pohon diberi label 'App' dengan dua anak panah yang mengarah ke simpul-simpul yang diberi label 'InspirationGenerator' dan 'FancyText'.
253+
Panah-panah tersebut merupakan garis solid dan diberi label dengan kata 'render'. Node 'InspirationGenerator' juga memiliki tiga anak panah. Panah ke node 'FancyText' dan 'Color' putus-putus dan diberi label 'renders? Panah terakhir mengarah ke node berlabel 'Copyright' dan berbentuk padat dan diberi label 'renders'.">
249254

250-
With conditional rendering, across different renders, the render tree may render different components.
255+
Dengan perenderan kondisional, pada *render* yang berbeda, pohon *render* dapat merender komponen yang berbeda.
251256

252257
</Diagram>
253258

0 commit comments

Comments
 (0)