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
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
+
5
12
<Intro>
6
13
7
-
`renderToStaticMarkup`renders a non-interactive React tree to an HTML string.
14
+
`renderToStaticMarkup`renderizza un albero React non interattivo in una stringa HTML.
It will produce non-interactive HTML output of your React components.
38
+
Produrrà un output HTML non interattivo dei tuoi componenti React.
32
39
33
-
[See more examples below.](#usage)
40
+
[Vedi altri esempi sotto.](#usage)
34
41
35
42
#### Parameters {/*parameters*/}
36
43
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.
40
47
41
48
#### Returns {/*returns*/}
42
49
43
-
An HTML string.
50
+
Una stringa HTML.
44
51
45
52
#### Caveats {/*caveats*/}
46
53
47
-
* `renderToStaticMarkup`output cannot be hydrated.
54
+
* L'output di `renderToStaticMarkup`non può essere idratato.
48
55
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.
50
57
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)
52
59
53
60
---
54
61
55
62
## Usage {/*usage*/}
56
63
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*/}
58
65
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:
//The route handler syntax depends on your backend framework
71
+
//La sintassi del route handler dipende dal tuo framework backend
65
72
app.use('/', (request, response) => {
66
73
consthtml=renderToStaticMarkup(<Page />);
67
74
response.send(html);
68
75
});
69
76
```
70
77
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.
72
79
73
80
<Pitfall>
74
81
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.
76
83
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.
0 commit comments