diff --git a/src/content/reference/react-dom/server/renderToPipeableStream.md b/src/content/reference/react-dom/server/renderToPipeableStream.md index 5d48c6a6..1fbd7560 100644 --- a/src/content/reference/react-dom/server/renderToPipeableStream.md +++ b/src/content/reference/react-dom/server/renderToPipeableStream.md @@ -4,7 +4,7 @@ title: renderToPipeableStream -`renderToPipeableStream` renders a React tree to a pipeable [Node.js Stream.](https://nodejs.org/api/stream.html) +`renderToPipeableStream` нь React модыг дамжуулах боломжтой [Node.js Stream](https://nodejs.org/api/stream.html) болгон дүрсэлнэ. ```js const { pipe, abort } = renderToPipeableStream(reactNode, options?) @@ -16,17 +16,17 @@ const { pipe, abort } = renderToPipeableStream(reactNode, options?) -This API is specific to Node.js. Environments with [Web Streams,](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) like Deno and modern edge runtimes, should use [`renderToReadableStream`](/reference/react-dom/server/renderToReadableStream) instead. +Энэ API нь зөвхөн Node.js-д зориулагдсан. Deno болон орчин үеийн edge runtime зэрэг [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API)-ийг дэмждэг орчинд [`renderToReadableStream`](/reference/react-dom/server/renderToReadableStream)-ийг ашиглана уу. --- -## Reference {/*reference*/} +## Лавлагаа {/*reference*/} ### `renderToPipeableStream(reactNode, options?)` {/*rendertopipeablestream*/} -Call `renderToPipeableStream` to render your React tree as HTML into a [Node.js Stream.](https://nodejs.org/api/stream.html#writable-streams) +React модыг HTML болгон [Node.js Stream](https://nodejs.org/api/stream.html#writable-streams) рүү дүрслэхийн тулд `renderToPipeableStream`-ийг дуудна. ```js import { renderToPipeableStream } from 'react-dom/server'; @@ -40,43 +40,43 @@ const { pipe } = renderToPipeableStream(, { }); ``` -On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to make the server-generated HTML interactive. +Серверийн үүсгэсэн HTML-ийг интерактив болгохын тулд клиент талд [`hydrateRoot`](/reference/react-dom/client/hydrateRoot)-ийг дуудна. -[See more examples below.](#usage) +[Доорх бусад жишээг үзнэ үү.](#usage) -#### Parameters {/*parameters*/} +#### Параметрүүд {/*parameters*/} -* `reactNode`: A React node you want to render to HTML. For example, a JSX element like ``. It is expected to represent the entire document, so the `App` component should render the `` tag. +* `reactNode`: HTML болгон дүрслэх React node. Жишээлбэл, `` шиг JSX элемент. Энэ нь баримт бичгийг бүхэлд нь төлөөлөх ёстой тул `App` компонент `` tag-ийг дүрслэх хэрэгтэй. -* **optional** `options`: An object with streaming options. - * **optional** `bootstrapScriptContent`: If specified, this string will be placed in an inline ` ``` -On the client, your bootstrap script should [hydrate the entire `document` with a call to `hydrateRoot`:](/reference/react-dom/client/hydrateRoot#hydrating-an-entire-document) +Клиент талд bootstrap script нь [`hydrateRoot`-ийг дуудаж `document`-ийг бүхэлд нь hydrate хийх](/reference/react-dom/client/hydrateRoot#hydrating-an-entire-document) ёстой: ```js [[1, 4, ""]] import { hydrateRoot } from 'react-dom/client'; @@ -134,15 +134,15 @@ import App from './App.js'; hydrateRoot(document, ); ``` -This will attach event listeners to the server-generated HTML and make it interactive. +Ингэснээр серверийн үүсгэсэн HTML-д event listener-үүд холбогдож, интерактив болно. -#### Reading CSS and JS asset paths from the build output {/*reading-css-and-js-asset-paths-from-the-build-output*/} +#### Build-ийн үр дүнгээс CSS болон JS asset-ийн замыг унших {/*reading-css-and-js-asset-paths-from-the-build-output*/} -The final asset URLs (like JavaScript and CSS files) are often hashed after the build. For example, instead of `styles.css` you might end up with `styles.123456.css`. Hashing static asset filenames guarantees that every distinct build of the same asset will have a different filename. This is useful because it lets you safely enable long-term caching for static assets: a file with a certain name would never change content. +Эцсийн asset URL-уудыг (JavaScript болон CSS файл гэх мэт) build-ийн дараа ихэвчлэн hash-ладаг. Жишээлбэл, `styles.css`-ийн оронд `styles.123456.css` үүсэж болно. Статик asset-ийн файлын нэрийг hash-ласнаар нэг asset-ийн build бүр өөр нэртэй байна. Ингэснээр тодорхой нэртэй файлын агуулга хэзээ ч өөрчлөгдөхгүй тул статик asset-д урт хугацааны cache-ийг аюулгүй идэвхжүүлж болно. -However, if you don't know the asset URLs until after the build, there's no way for you to put them in the source code. For example, hardcoding `"/styles.css"` into JSX like earlier wouldn't work. To keep them out of your source code, your root component can read the real filenames from a map passed as a prop: +Гэвч asset URL-уудыг build дууссаны дараа л мэдэх боломжтой бол source code-д урьдчилан бичиж чадахгүй. Жишээлбэл, өмнөх шиг `"/styles.css"`-ийг JSX-д hardcode хийх нь ажиллахгүй. Эдгээрийг source code-оос тусгаарлахын тулд root компонент prop-оор дамжуулсан map-аас жинхэнэ файлын нэрийг уншиж болно: ```js {1,6} export default function App({ assetMap }) { @@ -159,7 +159,7 @@ export default function App({ assetMap }) { } ``` -On the server, render `` and pass your `assetMap` with the asset URLs: +Сервер талд ``-ийг дүрсэлж, asset URL-уудтай `assetMap`-ийг дамжуулна: ```js {1-5,8,9} // You'd need to get this JSON from your build tooling, e.g. read it from the build output. @@ -179,7 +179,7 @@ app.use('/', (request, response) => { }); ``` -Since your server is now rendering ``, you need to render it with `assetMap` on the client too to avoid hydration errors. You can serialize and pass `assetMap` to the client like this: +Сервер одоо ``-ийг дүрсэлж байгаа тул hydration алдаанаас сэргийлэхийн тулд клиент талд мөн `assetMap`-тай дүрслэх хэрэгтэй. `assetMap`-ийг serialize хийж клиент рүү дараах байдлаар дамжуулна: ```js {9-10} // You'd need to get this JSON from your build tooling. @@ -201,7 +201,7 @@ app.use('/', (request, response) => { }); ``` -In the example above, the `bootstrapScriptContent` option adds an extra inline `