Skip to content

Commit 0d50c71

Browse files
committed
translate(reference): renderToStaticMarkup
Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
1 parent d9e845e commit 0d50c71

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
---
22
title: renderToStaticMarkup
3+
translationStatus: ai-draft
34
---
45

6+
<Note>
7+
8+
Questa pagina è stata tradotta automaticamente e supervisionata da un maintainer. Un'ulteriore revisione da parte della community sarebbe comunque utile. [Migliora questa traduzione](https://github.com/reactjs/it.react.dev/edit/main/src/content/reference/react-dom/server/renderToStaticMarkup.md).
9+
10+
</Note>
11+
512
<Intro>
613

7-
`renderToStaticMarkup` renders a non-interactive React tree to an HTML string.
14+
`renderToStaticMarkup` renderizza un albero React non interattivo in una stringa HTML.
815

916
```js
1017
const html = renderToStaticMarkup(reactNode, options?)
@@ -20,60 +27,60 @@ const html = renderToStaticMarkup(reactNode, options?)
2027
2128
### `renderToStaticMarkup(reactNode, options?)` {/*rendertostaticmarkup*/}
2229
23-
On the server, call `renderToStaticMarkup` to render your app to HTML.
30+
Sul server, chiama `renderToStaticMarkup` per renderizzare la tua app in HTML.
2431
2532
```js
2633
import { renderToStaticMarkup } from 'react-dom/server';
2734

2835
const html = renderToStaticMarkup(<Page />);
2936
```
3037
31-
It will produce non-interactive HTML output of your React components.
38+
Produrrà un output HTML non interattivo dei tuoi componenti React.
3239
33-
[See more examples below.](#usage)
40+
[Vedi altri esempi sotto.](#usage)
3441
3542
#### Parameters {/*parameters*/}
3643
37-
* `reactNode`: A React node you want to render to HTML. For example, a JSX node like `<Page />`.
38-
* **optional** `options`: An object for server render.
39-
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page.
44+
* `reactNode`: Un nodo React che vuoi renderizzare in HTML. Ad esempio, un nodo JSX come `<Page />`.
45+
* **optional** `options`: Un oggetto per la renderizzazione sul server.
46+
* **optional** `identifierPrefix`: Un prefisso stringa che React usa per gli ID generati da [`useId`.](/reference/react/useId) Utile per evitare conflitti quando usi più root sulla stessa pagina.
4047
4148
#### Returns {/*returns*/}
4249
43-
An HTML string.
50+
Una stringa HTML.
4451
4552
#### Caveats {/*caveats*/}
4653
47-
* `renderToStaticMarkup` output cannot be hydrated.
54+
* L'output di `renderToStaticMarkup` non può essere idratato.
4855
49-
* `renderToStaticMarkup` has limited Suspense support. If a component suspends, `renderToStaticMarkup` immediately sends its fallback as HTML.
56+
* `renderToStaticMarkup` ha un supporto limitato a Suspense. Se un componente sospende, `renderToStaticMarkup` invia immediatamente il suo fallback come HTML.
5057
51-
* `renderToStaticMarkup` works in the browser, but using it in the client code is not recommended. If you need to render a component to HTML in the browser, [get the HTML by rendering it into a DOM node.](/reference/react-dom/server/renderToString#removing-rendertostring-from-the-client-code)
58+
* `renderToStaticMarkup` funziona nel browser, ma usarlo nel codice client non è consigliato. Se devi renderizzare un componente in HTML nel browser, [ottieni l'HTML renderizzandolo in un nodo DOM.](/reference/react-dom/server/renderToString#removing-rendertostring-from-the-client-code)
5259
5360
---
5461
5562
## Usage {/*usage*/}
5663
57-
### Rendering a non-interactive React tree as HTML to a string {/*rendering-a-non-interactive-react-tree-as-html-to-a-string*/}
64+
### Renderizzare un albero React non interattivo come HTML in una stringa {/*rendering-a-non-interactive-react-tree-as-html-to-a-string*/}
5865
59-
Call `renderToStaticMarkup` to render your app to an HTML string which you can send with your server response:
66+
Chiama `renderToStaticMarkup` per renderizzare la tua app in una stringa HTML che puoi inviare con la risposta del server:
6067
6168
```js {5-6}
6269
import { renderToStaticMarkup } from 'react-dom/server';
6370

64-
// The route handler syntax depends on your backend framework
71+
// La sintassi del route handler dipende dal tuo framework backend
6572
app.use('/', (request, response) => {
6673
const html = renderToStaticMarkup(<Page />);
6774
response.send(html);
6875
});
6976
```
7077
71-
This will produce the initial non-interactive HTML output of your React components.
78+
Questo produrrà l'output HTML non interattivo iniziale dei tuoi componenti React.
7279
7380
<Pitfall>
7481
75-
This method renders **non-interactive HTML that cannot be hydrated.** This is useful if you want to use React as a simple static page generator, or if you're rendering completely static content like emails.
82+
Questo metodo renderizza **HTML non interattivo che non può essere idratato.** È utile se vuoi usare React come semplice generatore di pagine statiche, o se renderizzi contenuto completamente statico come email.
7683
77-
Interactive apps should use [`renderToString`](/reference/react-dom/server/renderToString) on the server and [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) on the client.
84+
Le app interattive dovrebbero usare [`renderToString`](/reference/react-dom/server/renderToString) sul server e [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) sul client.
7885
7986
</Pitfall>

0 commit comments

Comments
 (0)