Skip to content

Commit a8edcd1

Browse files
committed
Translate Fragments
1 parent fb98df2 commit a8edcd1

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

content/docs/fragments.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Fragments
44
permalink: docs/fragments.html
55
---
66

7-
A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding extra nodes to the DOM.
7+
Salah satu pola umum pada React adalah mengembalikan banyak elemen sekaligus. *Fragments* memungkinkan kamu untuk mengelompokkan sejumlah elemen anak tanpa perlu menambahkan lagi *node* ekstra ke *DOM*.
88

99
```js
1010
render() {
@@ -18,11 +18,11 @@ render() {
1818
}
1919
```
2020

21-
There is also a new [short syntax](#short-syntax) for declaring them.
21+
Terdapat juga [sintaksis singkat](#short-syntax) baru untuk mendeklarasikannya.
2222

23-
## Motivation {#motivation}
23+
## Motivasi {#motivation}
2424

25-
A common pattern is for a component to return a list of children. Take this example React snippet:
25+
Sebuah pola umum untuk komponen mengembalikan sejumlah elemen anak. Lihat contoh potongan kode React berikut.
2626

2727
```jsx
2828
class Table extends React.Component {
@@ -38,7 +38,7 @@ class Table extends React.Component {
3838
}
3939
```
4040

41-
`<Columns />` would need to return multiple `<td>` elements in order for the rendered HTML to be valid. If a parent div was used inside the `render()` of `<Columns />`, then the resulting HTML will be invalid.
41+
`<Columns />` harus mengembalikan sejumlah elemen `<td>` untuk menghasilkan HTML dengan benar. Jika div induk digunakan didalam `render()` pada `<Columns />`, maka akan menghasilkan HTML yang tidak benar.
4242

4343
```jsx
4444
class Columns extends React.Component {
@@ -53,7 +53,7 @@ class Columns extends React.Component {
5353
}
5454
```
5555

56-
results in a `<Table />` output of:
56+
menghasilkan sebuah `<Table />` dengan luaran:
5757

5858
```jsx
5959
<table>
@@ -66,9 +66,9 @@ results in a `<Table />` output of:
6666
</table>
6767
```
6868

69-
Fragments solve this problem.
69+
*Fragments* menyelesaikan masalah ini.
7070

71-
## Usage {#usage}
71+
## Penggunaan {#usage}
7272

7373
```jsx{4,7}
7474
class Columns extends React.Component {
@@ -83,7 +83,7 @@ class Columns extends React.Component {
8383
}
8484
```
8585

86-
which results in a correct `<Table />` output of:
86+
yang menghasilkan luaran `<Table />` dengan benar berupa:
8787

8888
```jsx
8989
<table>
@@ -94,9 +94,9 @@ which results in a correct `<Table />` output of:
9494
</table>
9595
```
9696

97-
### Short Syntax {#short-syntax}
97+
### Sintaksis Singkat {#short-syntax}
9898

99-
There is a new, shorter syntax you can use for declaring fragments. It looks like empty tags:
99+
Terdapat sintaksis baru dan lebih singkat yang bisa kamu gunakan untuk mendeklarasikan *fragments*. Itu terlihat seperti *tag* kosong:
100100

101101
```jsx{4,7}
102102
class Columns extends React.Component {
@@ -111,18 +111,18 @@ class Columns extends React.Component {
111111
}
112112
```
113113

114-
You can use `<></>` the same way you'd use any other element except that it doesn't support keys or attributes.
114+
Kamu bisa menggunakan `<></>` dengan cara yang sama kamu menggunakan elemen lainnya namun hal ini tidak mendukung *key* maupun atribut.
115115

116-
### Keyed Fragments {#keyed-fragments}
116+
### Fragments dengan Key {#keyed-fragments}
117117

118-
Fragments declared with the explicit `<React.Fragment>` syntax may have keys. A use case for this is mapping a collection to an array of fragments -- for example, to create a description list:
118+
*Fragments* yang dideklarasikan secara eksplisit dengan sintaksis `<React.Fragment>` bisa memiliki *key*. Contoh kasus untuk ini yaitu saat melakukan pemetaan sebuah koleksi menjadi larik sejumlah *fragment* -- contohnya saat membuat daftar deskripsi:
119119

120120
```jsx
121121
function Glossary(props) {
122122
return (
123123
<dl>
124124
{props.items.map(item => (
125-
// Without the `key`, React will fire a key warning
125+
// Tanpa `key`, React akan mengirimkan peringatan key
126126
<React.Fragment key={item.id}>
127127
<dt>{item.term}</dt>
128128
<dd>{item.description}</dd>
@@ -133,8 +133,8 @@ function Glossary(props) {
133133
}
134134
```
135135

136-
`key` is the only attribute that can be passed to `Fragment`. In the future, we may add support for additional attributes, such as event handlers.
136+
`key` merupakan satu-satunya atribut yang bisa diberikan kepada `Fragment`. Kedepannya, kami mungkin menambahkan dukungan untuk atribut lain, seperti penanganan *event*.
137137

138-
### Live Demo {#live-demo}
138+
### Demonstrasi Langsung {#live-demo}
139139

140-
You can try out the new JSX fragment syntax with this [CodePen](https://codepen.io/reactjs/pen/VrEbjE?editors=1000).
140+
Kamu dapat mencoba langsung sintaksis baru JSX *fragment* dengan ini [CodePen](https://codepen.io/reactjs/pen/VrEbjE?editors=1000).

0 commit comments

Comments
 (0)