Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate 'ReactDomServer' #81

Merged
merged 7 commits into from Apr 26, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 20 additions & 20 deletions content/docs/reference-react-dom-server.md
Expand Up @@ -6,7 +6,7 @@ category: Reference
permalink: docs/react-dom-server.html
---

The `ReactDOMServer` object enables you to render components to static markup. Typically, it's used on a Node server:
Obiekt `ReactDOMServer` pozwala na renderowanie komponent贸w do statycznych znacznik贸w. Zazwyczaj jest u偶ywany na serwerze Node:
g12i marked this conversation as resolved.
Show resolved Hide resolved

```js
// ES modules
Expand All @@ -15,31 +15,31 @@ import ReactDOMServer from 'react-dom/server';
var ReactDOMServer = require('react-dom/server');
```

## Overview {#overview}
## Og贸lne informacje {#overview}

The following methods can be used in both the server and browser environments:
Nast臋puj膮ce metody mog膮 zosta膰 u偶yte zar贸wno na serwerze, jak i w przegl膮darce:

- [`renderToString()`](#rendertostring)
- [`renderToStaticMarkup()`](#rendertostaticmarkup)

These additional methods depend on a package (`stream`) that is **only available on the server**, and won't work in the browser.
Kolejne metody zale偶膮 od pakietu (`stream`), kt贸ry **dost臋pny jest tylko na serwerze** i nie zadzia艂aj膮 w przegl膮darce.
g12i marked this conversation as resolved.
Show resolved Hide resolved

- [`renderToNodeStream()`](#rendertonodestream)
- [`renderToStaticNodeStream()`](#rendertostaticnodestream)

* * *

## Reference {#reference}
## Dokumentacja {#reference}

### `renderToString()` {#rendertostring}

```javascript
ReactDOMServer.renderToString(element)
```

Render a React element to its initial HTML. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
Renderuje reactowy element do jego pocz膮tkowego kodu HTML. React zwr贸ci ci膮g znak贸w HTML. Mo偶esz u偶y膰 tej metody do wygenerowania kodu HTML po stronie serwera, a nast臋pnie odes艂ania znacznik贸w, jako odpowiedzi na pocz膮tkowe zapytanie, aby przy艣pieszy膰 艂adowanie strony i umo偶liwi膰 wyszukiwarkom indeksowania stron w celach SEO.
g12i marked this conversation as resolved.
Show resolved Hide resolved

If you call [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) on a node that already has this server-rendered markup, React will preserve it and only attach event handlers, allowing you to have a very performant first-load experience.
Je艣li wywo艂asz metod臋 [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) na w臋藕le, kt贸ry zawiera ju偶 znaczniki wyrenderowane po stronie serwera, React zachowa je i do艂膮czy jedynie procedury obs艂ugi zdarze艅. Co poprawi wydajno艣膰 i wra偶enia z pierwszego 艂adowania.
g12i marked this conversation as resolved.
Show resolved Hide resolved

* * *

Expand All @@ -49,9 +49,9 @@ If you call [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) on a node that
ReactDOMServer.renderToStaticMarkup(element)
```

Similar to [`renderToString`](#rendertostring), except this doesn't create extra DOM attributes that React uses internally, such as `data-reactroot`. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save some bytes.
Dzia艂a analogicznie do [`renderToString`](#rendertostring), z t膮 r贸偶nic膮, 偶e nie tworzy dodatkowych atrybut贸w DOM, takich jak `data-reactroot` (u偶ywanych wewn臋trznie przez Reacta). Jest to przydatne, je艣li chcesz u偶ywa膰 Reacta jako prostego generatora statycznych stron, gdzie usuni臋cie dodatkowych atrybut贸w pozwoli zaoszcz臋dzi膰 kilka bajt贸w.
g12i marked this conversation as resolved.
Show resolved Hide resolved

If you plan to use React on the client to make the markup interactive, do not use this method. Instead, use [`renderToString`](#rendertostring) on the server and [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) on the client.
Je偶eli planujesz u偶ywa膰 Reacta po stronie klienta aby doda膰 znacznikom interaktywno艣ci nie u偶ywaj tej metody. Zamiast tego u偶yj [`renderToString`](#rendertostring) na serwerze i [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) po stronie klienta.
g12i marked this conversation as resolved.
Show resolved Hide resolved

* * *

Expand All @@ -61,15 +61,15 @@ If you plan to use React on the client to make the markup interactive, do not us
ReactDOMServer.renderToNodeStream(element)
```

Render a React element to its initial HTML. Returns a [Readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) that outputs an HTML string. The HTML output by this stream is exactly equal to what [`ReactDOMServer.renderToString`](#rendertostring) would return. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
Renderuje reactowy element do jego pocz膮tkowego kodu HTML. Zwraca [strumie艅 do odczytu](https://nodejs.org/api/stream.html#stream_readable_streams), kt贸ry na wyj艣ciu zwr贸ci ci膮g znak贸w HTML. Zwr贸cony przez strumie艅 kod HTML jest identyczny z tym, co zwr贸ci艂oby [`ReactDOMServer.renderToString`](#rendertostring). Mo偶esz u偶y膰 tej metody do wygenerowania kodu HTML po stronie serwera, a nast臋pnie odes艂ania znacznik贸w, jako odpowiedzi na pocz膮tkowe zapytanie, aby przy艣pieszy膰 艂adowanie strony i umo偶liwi膰 wyszukiwarkom indeksowania stron w celach pozycjonowania (ang. SEO).
g12i marked this conversation as resolved.
Show resolved Hide resolved

If you call [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) on a node that already has this server-rendered markup, React will preserve it and only attach event handlers, allowing you to have a very performant first-load experience.
Je艣li wywo艂asz metod臋 [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) na w臋藕le, kt贸ry zawiera ju偶 znaczniki wyrenderowane po stronie serwera, React zachowa je i do艂膮czy jedynie procedury obs艂ugi zdarze艅. Co poprawi wydajno艣膰 i wra偶enia z pierwszego 艂adowania.
g12i marked this conversation as resolved.
Show resolved Hide resolved

> Note:
> Uwaga:
>
> Server-only. This API is not available in the browser.
> Do u偶ycia tylko po stronie serwera. Ten interfejs API nie jest dost臋pny w przegl膮darce.
>
> The stream returned from this method will return a byte stream encoded in utf-8. If you need a stream in another encoding, take a look at a project like [iconv-lite](https://www.npmjs.com/package/iconv-lite), which provides transform streams for transcoding text.
> Strumie艅 zwr贸cony z tej metody zwr贸ci strumie艅 bajt贸w zakodowany w utf-8. Je艣li potrzebujesz strumienia w innym kodowaniu, sprawd藕 projekt taki jak [iconv-lite](https://www.npmjs.com/package/iconv-lite), kt贸ry dostarcza strumienie transformacji do transkodowania tekstu.
g12i marked this conversation as resolved.
Show resolved Hide resolved

* * *

Expand All @@ -79,14 +79,14 @@ If you call [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) on a node that
ReactDOMServer.renderToStaticNodeStream(element)
```

Similar to [`renderToNodeStream`](#rendertonodestream), except this doesn't create extra DOM attributes that React uses internally, such as `data-reactroot`. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save some bytes.
Dzia艂a analogicznie do [`renderToNodeStream`](#rendertonodestream), z t膮 r贸偶nic膮, 偶e nie tworzy dodatkowych atrybut贸w DOM, takich jak` data-reactroot` (u偶ywanych wewn臋trznie przez Reacta). Jest to przydatne, je艣li chcesz u偶ywa膰 Reacta jako prostego generatora statycznych stron, gdzie usuni臋cie dodatkowych atrybut贸w pozwoli zaoszcz臋dzi膰 kilka bajt贸w.
g12i marked this conversation as resolved.
Show resolved Hide resolved

The HTML output by this stream is exactly equal to what [`ReactDOMServer.renderToStaticMarkup`](#rendertostaticmarkup) would return.
Zwr贸cony przez strumie艅 kod HTML jest identyczny z tym, co zwr贸ci艂oby [`ReactDOMServer.renderToStaticMarkup`](#rendertostaticmarkup).
g12i marked this conversation as resolved.
Show resolved Hide resolved

If you plan to use React on the client to make the markup interactive, do not use this method. Instead, use [`renderToNodeStream`](#rendertonodestream) on the server and [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) on the client.
Je偶eli planujesz u偶ywa膰 Reacta po stronie klienta aby doda膰 znacznikom interaktywno艣ci nie u偶ywaj tej metody. Zamiast tego u偶yj [`renderToNodeStream`](#rendertonodestream) na serwerze i [`ReactDOM.hydrate()`](/docs/react-dom.html#hydrate) po stronie klienta.
g12i marked this conversation as resolved.
Show resolved Hide resolved

> Note:
> Uwaga:
>
> Server-only. This API is not available in the browser.
> Do u偶ycia tylko po stronie serwera. Ten interfejs API nie jest dost臋pny w przegl膮darce.
>
> The stream returned from this method will return a byte stream encoded in utf-8. If you need a stream in another encoding, take a look at a project like [iconv-lite](https://www.npmjs.com/package/iconv-lite), which provides transform streams for transcoding text.
> Strumie艅 zwr贸cony z tej metody zwr贸ci strumie艅 bajt贸w zakodowany w utf-8. Je艣li potrzebujesz strumienia w innym kodowaniu, sprawd藕 projekt taki jak [iconv-lite](https://www.npmjs.com/package/iconv-lite), kt贸ry dostarcza strumienie transformacji do transkodowania tekstu.
g12i marked this conversation as resolved.
Show resolved Hide resolved