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/components-and-props.md
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -16,35 +16,35 @@ prev: rendering-elements.html
16
16
next: state-and-lifecycle.html
17
17
---
18
18
19
-
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. This page provides an introduction to the idea of components. You can find a [detailed component API reference here](/docs/react-component.html).
19
+
Komponenty pozwalają ci podzielić interfejs użytkownika na niezależne, pozwalające na ponowne użycie części i myśleć o każdej z nich osobno. Ta strona dostarcza wprowadzenie do pojęcia komponentów. Możesz znaleźć [szczegółowe odniesienie do API komponentów tutaj](/docs/react-component.html).
20
20
21
-
Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen.
21
+
Koncepcyjnie, komponenty są jak javascriptowe funkcje. Przyjmują one arbirtalne wkłady (nazywane "właściwościami") i zwracają reactowe elementy opisujące co powinno się pojawić na ekranie.
22
22
23
-
## Function and Class Components {#function-and-class-components}
23
+
## Komponenty funkcyjne i klasowe {#function-and-class-components}
24
24
25
-
The simplest way to define a component is to write a JavaScript function:
25
+
Najprostszym sposobem na zdefiniowanie komponentu jest napisanie javascriptowej funkcji:
26
26
27
27
```js
28
28
functionWelcome(props) {
29
-
return<h1>Hello, {props.name}</h1>;
29
+
return<h1>Cześć, {props.name}</h1>;
30
30
}
31
31
```
32
32
33
-
This function is a valid React component because it accepts a single "props" (which stands for properties) object argument with data and returns a React element. We call such components "function components" because they are literally JavaScript functions.
33
+
Ta funkcja jest uzasadnionym reactowym komponentem, bo przyjmuje pojedynczy argument "props" (który oznacza "właściwości" (ang. *properties*)) będący obiektem z danymi i zwraca reactowy element. Nazywamy takie komponenty "komponentami funkcyjnymi", bo są one dosłownie javascriptowymi funkcjami.
34
34
35
-
You can also use an [ES6 class](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes)to define a component:
35
+
Możesz również używać [klasy ES6](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes)aby zdefiniować komponent:
36
36
37
37
```js
38
38
classWelcomeextendsReact.Component {
39
39
render() {
40
-
return<h1>Hello, {this.props.name}</h1>;
40
+
return<h1>Cześć, {this.props.name}</h1>;
41
41
}
42
42
}
43
43
```
44
44
45
-
The above two components are equivalent from React's point of view.
45
+
Dwa powyższe komponenty są równoważne z punktu widzenia Reacta.
46
46
47
-
Classes have some additional features that we will discuss in the [next sections](/docs/state-and-lifecycle.html). Until then, we will use function components for their conciseness.
47
+
Klasy mają kilka dodatkowych cech, które przedyskutujemy w [kolejnych rozdziałach](/docs/state-and-lifecycle.html). Na ten czas bedziemy używać komponentów funkcyjnych dla ich zwięzłości.
0 commit comments