You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/web-components.md
+12-13Lines changed: 12 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
id: web-components
3
-
title: Web Components
3
+
title: 웹 컴포넌트
4
4
permalink: docs/web-components.html
5
5
redirect_from:
6
6
- "docs/webcomponents.html"
7
7
---
8
8
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와 [웹 컴포넌트](https://developer.mozilla.org/ko/docs/Web/Web_Components)는 서로 다른 문제를 해결하기 위해 만들어졌습니다. 웹 컴포넌트는 재사용할 수 있는 컴포넌트에 강한 캡슐화를 제공하는 반면, React는 데이터와 DOM을 동기화하는 선언적 라이브러리를 제공합니다.
10
10
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
+
두 목표는 상호보완적입니다. React에서 웹 컴포넌트를 사용할지, 웹 컴포넌트를 React에서 사용할지, 둘 다 사용할지는 자유롭게 정하실 수 있습니다.
12
12
13
-
## Using Web Components in React {#using-web-components-in-react}
13
+
## React에서 웹 컴포넌트 사용하기 {#using-web-components-in-react}
14
14
15
15
```javascript
16
16
classHelloMessageextendsReact.Component {
@@ -20,14 +20,13 @@ class HelloMessage extends React.Component {
20
20
}
21
21
```
22
22
23
-
> Note:
23
+
> 주의
24
24
>
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
+
> 웹 컴포넌트는 종종 강제성을 띠는 API를 열어놓고 있습니다. 예를 들어, `video`라는 웹 컴포넌트는 `play()`나 `pause()`라는 함수를 열어놓고 있을 것입니다. 이러한 웹 컴포넌트의 강제성을 띠는 API에 접근하기 위해서, DOM 노드에 직접 ref를 지정하는 것이 필요할 수 있습니다. 서드 파티 웹 컴포넌트를 사용 중이라면, 가장 좋은 해결방법은 웹 컴포넌트의 래퍼로서 동작하는 React 컴포넌트를 작성하는 것입니다.
26
26
>
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
+
> 웹 컴포넌트에서 나온 이벤트들은 React 렌더링 트리에 올바르게 전파되지 않을 수 있습니다. 이를 해결하기 위해 이벤트를 다루기 위한 핸들러를 React 컴포넌트 내에 각각 만들어야합니다.
29
28
30
-
One common confusion is that Web Components use "class" instead of "className".
29
+
많은 사람이 공통으로 착각하는 부분 중 하나로, 웹 컴포넌트는 “className”이 아닌 “class”를 사용합니다.
31
30
32
31
```javascript
33
32
functionBrickFlipbox() {
@@ -40,7 +39,7 @@ function BrickFlipbox() {
40
39
}
41
40
```
42
41
43
-
## Using React in your Web Components {#using-react-in-your-web-components}
42
+
## 웹 컴포넌트에서 React 사용하기 {#using-react-in-your-web-components}
44
43
45
44
```javascript
46
45
classXSearchextendsHTMLElement {
@@ -56,7 +55,7 @@ class XSearch extends HTMLElement {
56
55
customElements.define('x-search', XSearch);
57
56
```
58
57
59
-
>Note:
58
+
>주의
60
59
>
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/webcomponentsjs#custom-elements-es5-adapterjs) before you load your web components to fix this issue.
>이 문제를 해결하려면 웹 컴포넌트를 불러오기 전에 [custom-elements-es5-adapter](https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs)를 추가하기 바랍니다.
0 commit comments