Skip to content

Commit 5de9071

Browse files
rub1ccresir014
authored andcommitted
Translate Advanced Guides/Web Components (#45)
* Translate Advanced Guides/Web Components * revise some stuffs: web components, some strings, ref, render
1 parent 7938fd7 commit 5de9071

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

content/docs/web-components.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@ redirect_from:
66
- "docs/webcomponents.html"
77
---
88

9-
React and [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) are built to solve different problems. Web Components provide strong encapsulation for reusable components, while React provides a declarative library that keeps the DOM in sync with your data. The two goals are complementary. As a developer, you are free to use React in your Web Components, or to use Web Components in React, or both.
9+
React dan [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) dibangun untuk menyelesaikan masalah yang berbeda. Web Components menyediakan enkapsulasi yang kuat untuk *reusable components*, sementara React menyediakan *library* yang deklaratif untuk menjaga DOM tetap sinkron dengan data Anda. Tujuan keduanya adalah untuk saling melengkapi. Sebagai pengembang atau *developer*, Anda bebas untuk menggunakan React di dalam Web Components Anda, atau menggunakan Web Components di dalam React, ataupun keduanya.
1010

11-
Most people who use React don't use Web Components, but you may want to, especially if you are using third-party UI components that are written using Web Components.
11+
Kebanyakan orang yang menggunakan React tidak menggunakan Web Components, tetapi mungkin Anda menginginkannya, terutama jika Anda menggunakan *library* komponen antarmuka pengguna pihak ketiga yang ditulis menggunakan Web Components.
1212

13-
## Using Web Components in React {#using-web-components-in-react}
13+
## Menggunakan Web Components di dalam React {#using-web-components-in-react}
1414

1515
```javascript
1616
class HelloMessage extends React.Component {
1717
render() {
18-
return <div>Hello <x-search>{this.props.name}</x-search>!</div>;
18+
return <div>Halo <x-search>{this.props.name}</x-search>!</div>;
1919
}
2020
}
2121
```
2222

23-
> Note:
23+
> Catatan:
2424
>
25-
> Web Components often expose an imperative API. For instance, a `video` Web Component might expose `play()` and `pause()` functions. To access the imperative APIs of a Web Component, you will need to use a ref to interact with the DOM node directly. If you are using third-party Web Components, the best solution is to write a React component that behaves as a wrapper for your Web Component.
25+
> Web Components sering kali memiliki API yang bersifat imperatif. Contohnya, Web Component video mungkin memiliki fungsi `play()` dan `pause()`. Untuk mengakses API yang imperatif dari sebuah Web Component, Anda perlu menggunakan `ref` untuk berinteraksi dengan simpul DOM secara langsung. Jika Anda menggunakan Web Components pihak ketiga, solusi terbaik adalah dengan menulis komponen React yang membungkus Web Component Anda.
2626
>
27-
> Events emitted by a Web Component may not properly propagate through a React render tree.
28-
> You will need to manually attach event handlers to handle these events within your React components.
27+
> *Events* yang dihasilkan oleh Web Component mungkin tidak terdistribusi dengan benar melalui pohon *render* React.
28+
> Anda perlu menambahkan *event handlers* secara manual untuk menangani *events* yang terdapat dalam komponen React Anda.
2929
30-
One common confusion is that Web Components use "class" instead of "className".
30+
Satu yang biasanya membingungkan, yaitu Web Components menggunakan "class" bukan "className".
3131

3232
```javascript
3333
function BrickFlipbox() {
3434
return (
3535
<brick-flipbox class="demo">
36-
<div>front</div>
37-
<div>back</div>
36+
<div>depan</div>
37+
<div>belakang</div>
3838
</brick-flipbox>
3939
);
4040
}
4141
```
4242

43-
## Using React in your Web Components {#using-react-in-your-web-components}
43+
## Menggunakan React di dalam Web Components Anda {#using-react-in-your-web-components}
4444

4545
```javascript
4646
class XSearch extends HTMLElement {
@@ -56,7 +56,7 @@ class XSearch extends HTMLElement {
5656
customElements.define('x-search', XSearch);
5757
```
5858

59-
>Note:
59+
> Catatan:
6060
>
61-
>This code **will not** work if you transform classes with Babel. See [this issue](https://github.com/w3c/webcomponents/issues/587) for the discussion.
62-
>Include the [custom-elements-es5-adapter](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs#custom-elements-es5-adapterjs) before you load your web components to fix this issue.
61+
> Kode ini **tidak akan** bekerja jika Anda merubah kelas dengan Babel. Untuk detail dan diskusi, lihat [masalah ini](https://github.com/w3c/webcomponents/issues/587).
62+
> Tambahkan [custom-elements-es5-adapter](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs#custom-elements-es5-adapterjs) sebelum Anda memuat Web Components Anda untuk memperbaiki masalah tersebut.

0 commit comments

Comments
 (0)