Skip to content

Commit a29e196

Browse files
authored
Translate 'Unknown Prop' warning page (#97)
1 parent eeb0e39 commit a29e196

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

content/warnings/unknown-prop.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,39 @@ title: Unknown Prop Warning
33
layout: single
44
permalink: warnings/unknown-prop.html
55
---
6-
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as a legal DOM attribute/property. You should ensure that your DOM elements do not have spurious props floating around.
6+
Ostrzeżenie o nieznanej właściwości (ang. *unknown prop*) pojawi się, gdy spróbujesz wyrenderować element DOM z właściwością, której React nie rozpoznaje jako poprawną dla DOM. Upewnij się, że twoje komponenty nie przekazują do elementów DOM żadnych własnych atrybutów.
77

8-
There are a couple of likely reasons this warning could be appearing:
8+
Istnieje kilka prawdopodobnych powodów pojawienia się tego ostrzeżenia:
99

10-
1. Are you using `{...this.props}` or `cloneElement(element, this.props)`? Your component is transferring its own props directly to a child element (eg. [transferring props](/docs/transferring-props.html)). When transferring props to a child component, you should ensure that you are not accidentally forwarding props that were intended to be interpreted by the parent component.
10+
1. Używasz składni `{...this.props}` lub `cloneElement(element, this.props)`? Twój komponent przekazuje w ten sposób wszystkie swoje właściwości (ang. *props*) do elementu potomnego ([przykład](/docs/transferring-props.html)). Przy przekazywaniu właściwości w dół musisz upewnić się, że przez pomyłkę nie uwzględniasz właściwości, które miały trafić tylko do komponentu nadrzędnego.
1111

12-
2. You are using a non-standard DOM attribute on a native DOM node, perhaps to represent custom data. If you are trying to attach custom data to a standard DOM element, consider using a custom data attribute as described [on MDN](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes).
12+
2. Używasz niestandardowego atrybutu DOM na natywnym węźle drzewa DOM, na przykład, aby przekazać mu jakieś dane. Jeśli chcesz zapisać w elemencie DOM dane, użyj odpowiedniego atrybutu, jak opisano [na MDN](https://developer.mozilla.org/pl/docs/Learn/HTML/Howto/Use_data_attributes).
1313

14-
3. React does not yet recognize the attribute you specified. This will likely be fixed in a future version of React. However, React currently strips all unknown attributes, so specifying them in your React app will not cause them to be rendered.
14+
3. React jeszcze nie rozpoznaje podanego przez ciebie atrybutu. Istnieje szansa, że zostanie to naprawione w przyszłych wersjach. Obecnie React usuwa wszystkie nieznane atrybuty, wobec czego nie zostaną one przekazane do renderowanego elementu DOM.
1515

16-
4. You are using a React component without an upper case. React interprets it as a DOM tag because [React JSX transform uses the upper vs. lower case convention to distinguish between user-defined components and DOM tags](/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized).
16+
4. Używasz komponentu reactowego, pisząc jego nazwę małymi literami. React interpretuje taki zapis jako znacznik DOM, ponieważ [transformacja składni JSX w Reakcie rozpoznaje własne komponenty po wielkich literach](/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized).
1717

1818
---
1919

20-
To fix this, composite components should "consume" any prop that is intended for the composite component and not intended for the child component. Example:
20+
Aby to naprawić, złożone komponenty powinny "konsumować" wszelkie właściwości przeznaczone dla nich, a nie przeznaczone dla komponentów potomnych. Na przykład:
2121

22-
**Bad:** Unexpected `layout` prop is forwarded to the `div` tag.
22+
**Źle:** Do elementu `div` przekazywana jest nieznana właściwość `layout`.
2323

24-
```js
24+
```js{4,7}
2525
function MyDiv(props) {
2626
if (props.layout === 'horizontal') {
27-
// BAD! Because you know for sure "layout" is not a prop that <div> understands.
27+
// ŹLE! Wiadomo, że właściwość "layout" nie jest obsługiwana przez <div>.
2828
return <div {...props} style={getHorizontalStyle()} />
2929
} else {
30-
// BAD! Because you know for sure "layout" is not a prop that <div> understands.
30+
// ŹLE! Wiadomo, że właściwość "layout" nie jest obsługiwana przez <div>.
3131
return <div {...props} style={getVerticalStyle()} />
3232
}
3333
}
3434
```
3535

36-
**Good:** The spread operator can be used to pull variables off props, and put the remaining props into a variable.
36+
**Dobrze:** Za pomocą operatora rozszczepienia (ang. *spread operator*) możesz wyciągnąć z obiektu interesujące wartości, a resztę spakować do osobnej zmiennej.
3737

38-
```js
38+
```js{2}
3939
function MyDiv(props) {
4040
const { layout, ...rest } = props
4141
if (layout === 'horizontal') {
@@ -46,9 +46,9 @@ function MyDiv(props) {
4646
}
4747
```
4848

49-
**Good:** You can also assign the props to a new object and delete the keys that you're using from the new object. Be sure not to delete the props from the original `this.props` object, since that object should be considered immutable.
49+
**Dobrze:** Możesz również przypisać właściwości do nowego obiektu i usunąć z niego użyte wartości. Pamiętaj jednak, aby nie usuwać niczego z pierwotnego obiektu `this.props` - jest on z założenia niezmienny (ang. *immutable*).
5050

51-
```js
51+
```js{3,4}
5252
function MyDiv(props) {
5353
5454
const divProps = Object.assign({}, props);

0 commit comments

Comments
 (0)