diff --git a/content/docs/jsx-in-depth.md b/content/docs/jsx-in-depth.md index eb3dc3a5b..17dc24ffb 100644 --- a/content/docs/jsx-in-depth.md +++ b/content/docs/jsx-in-depth.md @@ -1,6 +1,6 @@ --- id: jsx-in-depth -title: JSX In Depth +title: JSX w szczegółach permalink: docs/jsx-in-depth.html redirect_from: - "docs/jsx-spread.html" @@ -13,31 +13,31 @@ redirect_from: - "docs/jsx-in-depth-ko-KR.html" --- -Fundamentally, JSX just provides syntactic sugar for the `React.createElement(component, props, ...children)` function. The JSX code: +Zasadniczo, JSX dostarcza lukier składniowy dla funkcji `React.createElement(component, props, ...children)`. Kod JSX: ```js - Click Me + Kliknij mnie ``` -compiles into: +jest kompilowany do: ```js React.createElement( MyButton, {color: 'blue', shadowSize: 2}, - 'Click Me' + 'Kliknij mnie' ) ``` -You can also use the self-closing form of the tag if there are no children. So: +Jeżeli element nie posiada zagnieżdżonych tagów, możesz użyć tagu samozamykającego się. Wtedy kod: ```js
``` -compiles into: +jest kompilowany do: ```js React.createElement( @@ -47,19 +47,19 @@ React.createElement( ) ``` -If you want to test out how some specific JSX is converted into JavaScript, you can try out [the online Babel compiler](babel://jsx-simple-example). +Aby przetestować, jak JSX jest zamieniany na JavaScript, możesz wypróbować [kompilator Babel online](babel://jsx-simple-example). -## Specifying The React Element Type {#specifying-the-react-element-type} +## Określanie typu elementu {#specifying-the-react-element-type} -The first part of a JSX tag determines the type of the React element. +Pierwsza część tagu JSX określa typ elementu reactowego. -Capitalized types indicate that the JSX tag is referring to a React component. These tags get compiled into a direct reference to the named variable, so if you use the JSX `` expression, `Foo` must be in scope. +Wielka litera w tagu JSX oznacza, że jest on komponentem reactowym. Takie tagi są bezpośrednio kompilowane na referencję do zmiennej, więc jeżeli używasz w swoim kodzie JSX wyrażenia ``, to `Foo` musi znajdować się w zakresie. -### React Must Be in Scope {#react-must-be-in-scope} +### React musi znajdować się w zakresie {#react-must-be-in-scope} -Since JSX compiles into calls to `React.createElement`, the `React` library must also always be in scope from your JSX code. +Jako że JSX kompilowany jest do wywołania `React.createElement`, biblioteka `React` musi być w zakresie, w którym znajduje się twój kod JSX. -For example, both of the imports are necessary in this code, even though `React` and `CustomButton` are not directly referenced from JavaScript: +W przykładzie poniżej oba importy są konieczne, nawet jeżeli `React` i `CustomButton` nie mają żadnych bezpośrednich odniesień z kodu JavaScript: ```js{1,2,5} import React from 'react'; @@ -71,18 +71,18 @@ function WarningButton() { } ``` -If you don't use a JavaScript bundler and loaded React from a `