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: src/content/reference/react-dom/server/renderToNodeStream.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ title: renderToNodeStream
4
4
5
5
<Deprecated>
6
6
7
-
This API will be removed in a future major version of React. Use [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream) instead.
7
+
Cette API sera retirée d'une future version majeure de React. Utilisez plutôt [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream).
8
8
9
9
</Deprecated>
10
10
11
11
<Intro>
12
12
13
-
`renderToNodeStream`renders a React tree to a [Node.js Readable Stream.](https://nodejs.org/api/stream.html#readable-streams)
13
+
`renderToNodeStream`fait le rendu d'un arbre React dans un [flux Node.js en lecture](https://nodejs.org/api/stream.html#readable-streams).
On the server, call`renderToNodeStream`to get a [Node.js Readable Stream](https://nodejs.org/api/stream.html#readable-streams)which you can pipe into the response.
29
+
Côté serveur, appelez`renderToNodeStream`pour obtenir un [flux Node.js en lecture](https://nodejs.org/api/stream.html#readable-streams)que vous pouvez connecter *(pipe, NdT)* vers la réponse.
On the client, call[`hydrateRoot`](/reference/react-dom/client/hydrateRoot)to make the server-generated HTML interactive.
38
+
Côté client, appelez[`hydrateRoot`](/reference/react-dom/client/hydrateRoot)pour rendre interactif ce HTML généré côté serveur.
39
39
40
-
[See more examples below.](#usage)
40
+
[Voir d'autres exemples ci-dessous](#usage).
41
41
42
-
#### Parameters {/*parameters*/}
42
+
#### Paramètres {/*parameters*/}
43
43
44
-
*`reactNode`: A React node you want to render to HTML. For example, a JSX element like`<App />`.
44
+
*`reactNode` : un nœud React dont vous souhaitez produire le HTML. Ça pourrait par exemple être un élément JSX tel que`<App />`.
45
45
46
-
#### Returns {/*returns*/}
46
+
#### Valeur renvoyée {/*returns*/}
47
47
48
-
A [Node.js Readable Stream](https://nodejs.org/api/stream.html#readable-streams)that outputs an HTML string.
48
+
Un [flux Node.js en lecture](https://nodejs.org/api/stream.html#readable-streams)qui produit le texte HTML.
49
49
50
-
#### Caveats {/*caveats*/}
50
+
#### Limitations {/*caveats*/}
51
51
52
-
*This method will wait for all [Suspense boundaries](/reference/react/Suspense)to complete before returning any output.
52
+
*Cette méthode attendra que toutes les [frontières Suspense](/reference/react/Suspense)aboutissent avant de commencer à produire le moindre rendu.
53
53
54
-
*As of React 18, this method buffers all of its output, so it doesn't actually provide any streaming benefits. This is why it's recommended that you migrate to [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream) instead.
54
+
*À partir de React 18, cette méthode utilise un tampon pour l'ensemble de sa production, de sorte qu'elle n'a aucun des avantages du *streaming*. C'est pourquoi nous vous conseillons plutôt de migrer vers [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream).
55
55
56
-
*The returned stream is 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.
56
+
*Le flux renvoyé est encodé en UTF-8. Si vous avez besoin d'un flux avec un autre encodage, regardez les projets tels qu'[iconv-lite](https://www.npmjs.com/package/iconv-lite), qui fournissent des flux de transformation pour le transcodage de textes.
57
57
58
58
---
59
59
60
-
## Usage {/*usage*/}
60
+
## Utilisation {/*usage*/}
61
61
62
-
### Rendering a React tree as HTML to a Node.js Readable Stream {/*rendering-a-react-tree-as-html-to-a-nodejs-readable-stream*/}
62
+
### Produire le HTML d'un arbre React sous forme d'un flux Node.js en lecture {/*rendering-a-react-tree-as-html-to-a-nodejs-readable-stream*/}
63
63
64
-
Call`renderToNodeStream`to get a [Node.js Readable Stream](https://nodejs.org/api/stream.html#readable-streams)which you can pipe to your server response:
64
+
Appelez`renderToNodeStream`pour obtenir un [flux Node.js en lecture](https://nodejs.org/api/stream.html#readable-streams)que vous pouvez connecter *(pipe, NdT)* vers la réponse :
// The route handler syntax depends on your backend framework
69
+
// La syntaxe du gestionnaire de route dépend de votre
70
+
// framework côté serveur
70
71
app.use('/', (request, response) => {
71
72
conststream=renderToNodeStream(<App />);
72
73
stream.pipe(response);
73
74
});
74
75
```
75
76
76
-
The stream will produce the initial non-interactive HTML output of your React components. On the client, you will need to call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot)to *hydrate* that server-generated HTML and make it interactive.
77
+
Le flux produira le HTML initial, non interactif, de vos composants React. Côté client, vous aurez besoin d'appeler [`hydrateRoot`](/reference/react-dom/client/hydrateRoot)pour *hydrater* ce HTML généré côté serveur et le rendre interactif.
0 commit comments