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
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 i [komponenty sieciowe](https://developer.mozilla.org/pl/docs/Web/Web_Components)(ang. *Web Components*) zostały stworzone do rozwiązywania różnych problemów. Komponenty sieciowe zapewniają silną enkapsulację w celu wielokrotnego użytku, a React jest deklaratywną biblioteką stworzoną do synchronizacji danych z modelem DOM. Te dwa cele się dopełniają. Jako deweloper możesz wykorzystywać Reacta w swoich komponentach sieciowych lub wykorzystywać komponenty sieciowe w Reakcie.
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
+
Większość osób korzystających z Reacta nie używa komponentów sieciowych, ale ty możesz chcieć to zrobić, zwłaszcza jeśli używasz zewnętrznych komponentów UI napisanych z wykorzystaniem komponentów sieciowych.
12
12
13
-
## Using Web Components in React {#using-web-components-in-react}
13
+
## Używanie komponentów sieciowych w Reakcie {#using-web-components-in-react}
> 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
+
> Komponenty sieciowe często udostępniają imperatywne API. Na przykład: komponent sieciowy `video`może udostępniać funkcje `play()`i`pause()`. Aby skorzystać z imperatywnego API komponentu sieciowego, możesz potrzebować użyć referencji (`ref`), aby nawiązać bezpośredni kontakt z węzłem drzewa DOM. Jeśli korzystasz z komponentów sieciowych innych osób, najlepszym rozwiązaniem będzie utworzenie reactowego komponentu służącego jako nakładka dla komponentu sieciowego.
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
+
> Zdarzenia emitowane przez komponent sieciowy mogą niewłaściwie propagować się przez reactowe drzewo renderowania.
28
+
> Aby obsłużyć te zdarzenia w komponencie reactowym, konieczne może być ręczne dodanie procedur obsługi zdarzeń.
29
29
30
-
One common confusion is that Web Components use "class" instead of "className".
30
+
Często mylonym aspektem komponentów sieciowych jest to, że korzystają z atrybutu "class", a nie "className".
31
31
32
32
```javascript
33
33
functionBrickFlipbox() {
@@ -40,7 +40,7 @@ function BrickFlipbox() {
40
40
}
41
41
```
42
42
43
-
## Using React in your Web Components {#using-react-in-your-web-components}
43
+
## Używanie Reacta w komponentach sieciowych {#using-react-in-your-web-components}
44
44
45
45
```javascript
46
46
classXSearchextendsHTMLElement {
@@ -56,7 +56,7 @@ class XSearch extends HTMLElement {
56
56
customElements.define('x-search', XSearch);
57
57
```
58
58
59
-
>Note:
59
+
>Uwaga:
60
60
>
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
+
>Ten kod **nie**zadziała, jeśli dokonujesz transformacji klas używając narzędzia Babel. Zobacz [dyskusję](https://github.com/w3c/webcomponents/issues/587)na ten temat, aby dowiedzieć się więcej.
62
+
>Aby rozwiązać ten problem, użyj [custom-elements-es5-adapter](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs#custom-elements-es5-adapterjs)przed załadowaniem komponentów sieciowych.
0 commit comments