|
1 | 1 | ---
|
2 |
| -title: "React DOM Components" |
| 2 | +title: "Komponen DOM React" |
3 | 3 | ---
|
4 | 4 |
|
5 | 5 | <Intro>
|
6 |
| - |
7 |
| -React supports all of the browser built-in [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) and [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Element) components. |
8 |
| - |
| 6 | +React mendukung semua komponen [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) dan [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Element) bawaan peramban. |
9 | 7 | </Intro>
|
10 | 8 |
|
11 | 9 | ---
|
12 | 10 |
|
13 |
| -## Common components {/*common-components*/} |
| 11 | +## Komponen-Komponen Umum {/*common-components*/} |
14 | 12 |
|
15 |
| -All of the built-in browser components support some props and events. |
| 13 | +Semua komponen bawaan peramban mendukung beberapa *props* dan *events*. |
16 | 14 |
|
17 |
| -* [Common components (e.g. `<div>`)](/reference/react-dom/components/common) |
| 15 | +* [Komponen-Komponen Umum (contoh: `<div>`)](/reference/react-dom/components/common) |
18 | 16 |
|
19 |
| -This includes React-specific props like `ref` and `dangerouslySetInnerHTML`. |
| 17 | +Ini termasuk *props* spesifik React seperti `ref` dan `dangerouslySetInnerHTML`. |
20 | 18 |
|
21 | 19 | ---
|
22 | 20 |
|
23 |
| -## Form components {/*form-components*/} |
| 21 | +## Komponen *Form* {/*form-components*/} |
24 | 22 |
|
25 |
| -These built-in browser components accept user input: |
| 23 | +Komponen-komponen bawaan peramban ini menerima masukan dari pengguna: |
26 | 24 |
|
27 | 25 | * [`<input>`](/reference/react-dom/components/input)
|
28 | 26 | * [`<select>`](/reference/react-dom/components/select)
|
29 | 27 | * [`<textarea>`](/reference/react-dom/components/textarea)
|
30 | 28 |
|
31 |
| -They are special in React because passing the `value` prop to them makes them *[controlled.](/reference/react-dom/components/input#controlling-an-input-with-a-state-variable)* |
| 29 | +Komponen-komponen tersebut spesial dalam React karena dengan mengoper *prop* `value` ke dalamnya, akan membuatnya menjadi *[controlled component.](/reference/react-dom/components/input#controlling-an-input-with-a-state-variable)* |
32 | 30 |
|
33 | 31 | ---
|
34 | 32 |
|
35 |
| -## All HTML components {/*all-html-components*/} |
| 33 | +## Semua komponen HTML {/*all-html-components*/} |
36 | 34 |
|
37 |
| -React supports all built-in browser HTML components. This includes: |
| 35 | +React mendukung semua komponen HTML bawaan peramban. Ini termasuk: |
38 | 36 |
|
39 | 37 | * [`<aside>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)
|
40 | 38 | * [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio)
|
@@ -140,38 +138,39 @@ React supports all built-in browser HTML components. This includes:
|
140 | 138 |
|
141 | 139 | <Note>
|
142 | 140 |
|
143 |
| -Similar to the [DOM standard,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React uses a `camelCase` convention for prop names. For example, you'll write `tabIndex` instead of `tabindex`. You can convert existing HTML to JSX with an [online converter.](https://transform.tools/html-to-jsx) |
| 141 | +Serupa dengan [standar panduan DOM,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React menggunakan konvensi *`camelCase`* untuk penamaan *props*. Sebagai contoh, Anda disarankan menulis `tabIndex` ketimbang `tabindex`. Anda dapat mengubah HTML yang telah ada menjadi JSX menggunakan [*online converter.*](https://transform.tools/html-to-jsx) |
144 | 142 |
|
145 | 143 | </Note>
|
146 | 144 |
|
147 | 145 | ---
|
148 | 146 |
|
149 |
| -### Custom HTML elements {/*custom-html-elements*/} |
| 147 | +### Elemen HTML *Custom* {/*custom-html-elements*/} |
| 148 | + |
| 149 | +Jika Anda *render* sebuah *tag* menggunakan tanda hubung, seperti `<my-element>`, React akan mengasumsikan Anda untuk *render* [elemen HTML *custom*.](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) Pada React, cara kerja *rendering* pada elemen *custom* akan berbeda dengan *rendering* pada *tags* bawaan peramban: |
150 | 150 |
|
151 |
| -If you render a tag with a dash, like `<my-element>`, React will assume you want to render a [custom HTML element.](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) In React, rendering custom elements works differently from rendering built-in browser tags: |
| 151 | +- Semua props dari *custom element* akan diserialisasikan menjadi *strings* dan selalu disetel menggunakan *attributes*. |
| 152 | +- *Custom elements* menerima `class` ketimbang `className`, dan `for` ketimbang `htmlFor`. |
152 | 153 |
|
153 |
| -- All custom element props are serialized to strings and are always set using attributes. |
154 |
| -- Custom elements accept `class` rather than `className`, and `for` rather than `htmlFor`. |
| 154 | +Jika Anda `render` sebuah elemen HTML bawaan peramban dengan atribut [`is`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is), maka itu akan diperlakukan sebagai *custom element*. |
155 | 155 |
|
156 |
| -If you render a built-in browser HTML element with an [`is`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is) attribute, it will also be treated as a custom element. |
157 | 156 |
|
158 | 157 | <Note>
|
159 | 158 |
|
160 |
| -[A future version of React will include more comprehensive support for custom elements.](https://github.com/facebook/react/issues/11347#issuecomment-1122275286) |
| 159 | +[Versi React mendatang akan menambahkan lebih banyak dukungan komprehensif untuk *custom elements*.](https://github.com/facebook/react/issues/11347#issuecomment-1122275286) |
161 | 160 |
|
162 |
| -You can try it by upgrading React packages to the most recent experimental version: |
| 161 | +Anda dapat mencobanya dengan memperbarui *packages* React ke versi eksperimental terbaru: |
163 | 162 |
|
164 | 163 | - `react@experimental`
|
165 | 164 | - `react-dom@experimental`
|
166 | 165 |
|
167 |
| -Experimental versions of React may contain bugs. Don't use them in production. |
| 166 | +Versi eksperimental mungkin mengandung *bugs*. Jangan digunakan di *production*. |
168 | 167 |
|
169 | 168 | </Note>
|
170 | 169 | ---
|
171 | 170 |
|
172 |
| -## All SVG components {/*all-svg-components*/} |
| 171 | +## Semua komponen SVG {/*all-svg-components*/} |
173 | 172 |
|
174 |
| -React supports all built-in browser SVG components. This includes: |
| 173 | +React mendukung semua komponen SVG bawaan peramban. Ini termasuk: |
175 | 174 |
|
176 | 175 | * [`<a>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a)
|
177 | 176 | * [`<animate>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/animate)
|
@@ -242,20 +241,20 @@ React supports all built-in browser SVG components. This includes:
|
242 | 241 |
|
243 | 242 | <Note>
|
244 | 243 |
|
245 |
| -Similar to the [DOM standard,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React uses a `camelCase` convention for prop names. For example, you'll write `tabIndex` instead of `tabindex`. You can convert existing SVG to JSX with an [online converter.](https://transform.tools/) |
246 |
| - |
247 |
| -Namespaced attributes also have to be written without the colon: |
248 |
| - |
249 |
| -* `xlink:actuate` becomes `xlinkActuate`. |
250 |
| -* `xlink:arcrole` becomes `xlinkArcrole`. |
251 |
| -* `xlink:href` becomes `xlinkHref`. |
252 |
| -* `xlink:role` becomes `xlinkRole`. |
253 |
| -* `xlink:show` becomes `xlinkShow`. |
254 |
| -* `xlink:title` becomes `xlinkTitle`. |
255 |
| -* `xlink:type` becomes `xlinkType`. |
256 |
| -* `xml:base` becomes `xmlBase`. |
257 |
| -* `xml:lang` becomes `xmlLang`. |
258 |
| -* `xml:space` becomes `xmlSpace`. |
259 |
| -* `xmlns:xlink` becomes `xmlnsXlink`. |
| 244 | +Serupa dengan [standar panduan DOM,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React menggunakan konvensi `camelCase` untuk penamaan *props*. Sebagai contoh, Anda disarankan untuk menuliskan `tabIndex` ketimbang `tabindex`. Anda juga dapat mengubah SVG yang telah ada ke JSX menggunakan [*online converter.*](https://transform.tools/) |
| 245 | + |
| 246 | +Atribut *namespaced* juga harus dituliskan tanpa tanda titik dua: |
| 247 | + |
| 248 | +* `xlink:actuate` menjadi `xlinkActuate`. |
| 249 | +* `xlink:arcrole` menjadi `xlinkArcrole`. |
| 250 | +* `xlink:href` menjadi `xlinkHref`. |
| 251 | +* `xlink:role` menjadi `xlinkRole`. |
| 252 | +* `xlink:show` menjadi `xlinkShow`. |
| 253 | +* `xlink:title` menjadi `xlinkTitle`. |
| 254 | +* `xlink:type` menjadi `xlinkType`. |
| 255 | +* `xml:base` menjadi `xmlBase`. |
| 256 | +* `xml:lang` menjadi `xmlLang`. |
| 257 | +* `xml:space` menjadi `xmlSpace`. |
| 258 | +* `xmlns:xlink` menjadi `xmlnsXlink`. |
260 | 259 |
|
261 | 260 | </Note>
|
0 commit comments