`, export a `Row` component, and manually wrap every row into it like this:
+Jika memungkinkan, hindari penggunaan *method* pada `Children`. Misalnya, jika Anda ingin setiap anak dari `RowList` dibungkus dengan `
`, ekspor komponen `Row`, dan secara manual membungkus setiap baris ke dalamnya seperti ini:
@@ -559,13 +559,13 @@ export default function App() {
return (
- This is the first item.
+ Ini adalah butir pertama.
- This is the second item.
+ Ini adalah butir kedua
- This is the third item.
+ Ini adalah butir ketiga.
);
@@ -607,7 +607,7 @@ export function Row({ children }) {
-Unlike using `Children.map`, this approach does not wrap every child automatically. **However, this approach has a significant benefit compared to the [earlier example with `Children.map`](#transforming-children) because it works even if you keep extracting more components.** For example, it still works if you extract your own `MoreRows` component:
+Tidak seperti menggunakan `Children.map`, pendekatan ini tidak membungkus setiap anak secara otomatis. **Namun, pendekatan ini memiliki keunggulan yang signifikan dibandingkan dengan [contoh sebelumnya dengan `Children.map`](#transforming-children) karena pendekatan ini tetap bekerja meskipun Anda terus mengekstrak lebih banyak komponen.** Sebagai contoh, pendekatan ini tetap bekerja jika Anda mengekstrak komponen `MoreRows` Anda sendiri:
@@ -618,7 +618,7 @@ export default function App() {
return (
- This is the first item.
+ Ini adalah butir pertama.
@@ -629,10 +629,10 @@ function MoreRows() {
return (
<>
- This is the second item.
+ Ini adalah butir kedua
- This is the third item.
+ Ini adalah butir ketiga.
>
);
@@ -674,13 +674,13 @@ export function Row({ children }) {
-This wouldn't work with `Children.map` because it would "see" `
` as a single child (and a single row).
+Hal ini tidak akan bekerja dengan `Children.map` karena fungsi tersebut akan "melihat" `
` sebagai satu anak (dan satu baris).
---
-### Accepting an array of objects as a prop {/*accepting-an-array-of-objects-as-a-prop*/}
+### Menerima senarai objek sebagai *prop* {/*accepting-an-array-of-objects-as-a-prop*/}
-You can also explicitly pass an array as a prop. For example, this `RowList` accepts a `rows` array as a prop:
+Anda juga bisa secara eksplisit mengoper senarai sebagai *prop*. Sebagai contoh, `RowList` ini menerima senarai `baris` sebagai *prop*:
@@ -690,9 +690,9 @@ import { RowList, Row } from './RowList.js';
export default function App() {
return (
This is the first item. },
- { id: 'second', content: This is the second item.
},
- { id: 'third', content: This is the third item.
}
+ { id: 'first', content: Ini adalah butir pertama.
},
+ { id: 'second', content: Ini adalah butir kedua
},
+ { id: 'third', content: Ini adalah butir ketiga.
}
]} />
);
}
@@ -729,9 +729,9 @@ export function RowList({ rows }) {
-Since `rows` is a regular JavaScript array, the `RowList` component can use built-in array methods like [`map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on it.
+Karena `rows` adalah senarai JavaScript biasa, komponen `RowList` dapat menggunakan *method* senarai bawaan seperti [`map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) di dalamnya.
-This pattern is especially useful when you want to be able to pass more information as structured data together with children. In the below example, the `TabSwitcher` component receives an array of objects as the `tabs` prop:
+Pola ini sangat berguna ketika Anda ingin memberikan lebih banyak informasi sebagai data terstruktur bersama dengan anak. Pada contoh di bawah ini, komponen `TabSwitcher` menerima senarai objek sebagai *prop* `tabs`:
@@ -744,17 +744,17 @@ export default function App() {
{
id: 'first',
header: 'First',
- content: This is the first item.
+ content: Ini adalah butir pertama.
},
{
id: 'second',
header: 'Second',
- content: This is the second item.
+ content: Ini adalah butir kedua
},
{
id: 'third',
header: 'Third',
- content: This is the third item.
+ content: Ini adalah butir ketiga.
}
]} />
);
@@ -789,13 +789,13 @@ export default function TabSwitcher({ tabs }) {
-Unlike passing the children as JSX, this approach lets you associate some extra data like `header` with each item. Because you are working with the `tabs` directly, and it is an array, you do not need the `Children` methods.
+Tidak seperti mengoper anak-anak sebagai JSX, pendekatan ini memungkinkan Anda untuk mengasosiasikan beberapa data tambahan seperti `header` dengan setiap item. Karena Anda bekerja dengan `tabs` secara langsung, dan `tabs` adalah sebuah senarai sehingga Anda tidak memerlukan *method* `Children`.
---
-### Calling a render prop to customize rendering {/*calling-a-render-prop-to-customize-rendering*/}
+### Memanggil *render prop* untuk menyesuaikan *rendering* {/*calling-a-render-prop-to-customize-rendering*/}
-Instead of producing JSX for every single item, you can also pass a function that returns JSX, and call that function when necessary. In this example, the `App` component passes a `renderContent` function to the `TabSwitcher` component. The `TabSwitcher` component calls `renderContent` only for the selected tab:
+Daripada menghasilkan JSX untuk setiap item, Anda juga bisa mengoper fungsi yang mengembalikan JSX, dan memanggil fungsi tersebut bila diperlukan. Pada contoh ini, komponen `Aplikasi` mengoper fungsi `renderContent` ke komponen `TabSwitcher`. Komponen `TabSwitcher` memanggil `renderContent` hanya untuk tab yang dipilih:
@@ -805,12 +805,12 @@ import TabSwitcher from './TabSwitcher.js';
export default function App() {
return (
{
return tabId[0].toUpperCase() + tabId.slice(1);
}}
renderContent={tabId => {
- return This is the {tabId} item.
;
+ return Ini adalah butir {tabId}.
;
}}
/>
);
@@ -844,9 +844,9 @@ export default function TabSwitcher({ tabIds, getHeader, renderContent }) {
-A prop like `renderContent` is called a *render prop* because it is a prop that specifies how to render a piece of the user interface. However, there is nothing special about it: it is a regular prop which happens to be a function.
+Sebuah *prop* seperti `renderContent` disebut sebagai *render prop* karena merupakan *prop* yang menentukan bagaimana cara me-*render* sebuah bagian dari antarmuka pengguna. Namun, tidak ada yang aneh dengan *prop* ini: *prop* ini adalah *prop* biasa yang kebetulan merupakan sebuah fungsi.
-Render props are functions, so you can pass information to them. For example, this `RowList` component passes the `id` and the `index` of each row to the `renderRow` render prop, which uses `index` to highlight even rows:
+*Render props* adalah fungsi, sehingga Anda dapat meneruskan informasi kepada mereka. Misalnya, komponen `RowList` ini meneruskan `id` dan `index` dari setiap baris ke *props render* `renderRow`, yang menggunakan `index` untuk menonjolkan baris genap:
@@ -856,11 +856,11 @@ import { RowList, Row } from './RowList.js';
export default function App() {
return (
{
return (
- This is the {id} item.
+ Ini adalah butir {id}.
);
}}
@@ -876,7 +876,7 @@ export function RowList({ rowIds, renderRow }) {
return (
- Total rows: {rowIds.length}
+ Jumlah baris: {rowIds.length}
{rowIds.map((rowId, index) =>
@@ -927,23 +927,23 @@ export function Row({ children, isHighlighted }) {
-This is another example of how parent and child components can cooperate without manipulating the children.
+Demikianlah contoh lain bagaimana komponen induk dan anak dapat bekerja sama tanpa memanipulasi anak-anaknya.
---
-## Troubleshooting {/*troubleshooting*/}
+## Pemecahan Masalah {/*troubleshooting*/}
-### I pass a custom component, but the `Children` methods don't show its render result {/*i-pass-a-custom-component-but-the-children-methods-dont-show-its-render-result*/}
+### Saya mengoper komponen kustom, tetapi *method* `Children` tidak menampilkan hasil *render*-nya {/*i-pass-a-custom-component-but-the-children-methods-dont-show-its-render-result*/}
-Suppose you pass two children to `RowList` like this:
+Misalkan Anda mengoper dua anak ke `RowList` seperti ini:
```js
- First item
+ Butir pertama
```
-If you do `Children.count(children)` inside `RowList`, you will get `2`. Even if `MoreRows` renders 10 different items, or if it returns `null`, `Children.count(children)` will still be `2`. From the `RowList`'s perspective, it only "sees" the JSX it has received. It does not "see" the internals of the `MoreRows` component.
+Jika Anda melakukan `Children.count(children)` di dalam `RowList`, Anda akan mendapatkan `2`. Bahkan jika `MoreRows` me-*render* 10 butir yang berbeda, atau jika mengembalikan `null`, `Children.count(children)` akan tetap menjadi `2`. Dari sudut pandang `RowList`, ia hanya "melihat" JSX yang diterimanya. Ia tidak "melihat" bagian internal komponen `MoreRows`.
-The limitation makes it hard to extract a component. This is why [alternatives](#alternatives) are preferred to using `Children`.
+Limitasi ini menyulitkan untuk mengekstrak sebuah komponen. Inilah sebabnya mengapa [alternatif](#alternatif) lebih disarankan daripada menggunakan `Children`.
\ No newline at end of file