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/blog/2024/04/25/react-19-upgrade-guide.md
+13-18Lines changed: 13 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "React 19 RC Upgrade Guide"
2
+
title: "React 19 Upgrade Guide"
3
3
author: Ricky Hanlon
4
4
date: 2024/04/25
5
5
description: The improvements added to React 19 require some breaking changes, but we've worked to make the upgrade as smooth as possible and we don't expect the changes to impact most apps. In this post, we will guide you through the steps for upgrading apps and libraries to React 19.
@@ -12,7 +12,7 @@ April 25, 2024 by [Ricky Hanlon](https://twitter.com/rickhanlonii)
12
12
13
13
<Intro>
14
14
15
-
The improvements added to React 19 RC require some breaking changes, but we've worked to make the upgrade as smooth as possible, and we don't expect the changes to impact most apps.
15
+
The improvements added to React 19 require some breaking changes, but we've worked to make the upgrade as smooth as possible, and we don't expect the changes to impact most apps.
16
16
17
17
</Intro>
18
18
@@ -38,7 +38,7 @@ In this post, we will guide you through the steps for upgrading to React 19:
38
38
-[TypeScript changes](#typescript-changes)
39
39
-[Changelog](#changelog)
40
40
41
-
If you'd like to help us test React 19, follow the steps in this upgrade guide and [report any issues](https://github.com/facebook/react/issues/new?assignees=&labels=React+19&projects=&template=19.md&title=%5BReact+19%5D) you encounter. For a list of new features added to React 19, see the [React 19 release post](/blog/2024/04/25/react-19).
41
+
If you'd like to help us test React 19, follow the steps in this upgrade guide and [report any issues](https://github.com/facebook/react/issues/new?assignees=&labels=React+19&projects=&template=19.md&title=%5BReact+19%5D) you encounter. For a list of new features added to React 19, see the [React 19 release post](/blog/2024/12/05/react-19).
42
42
43
43
---
44
44
## Installing {/*installing*/}
@@ -70,28 +70,23 @@ We expect most apps will not be affected since the transform is enabled in most
70
70
To install the latest version of React and React DOM:
If you're using TypeScript, you also need to update the types. Once React 19 is released as stable, you can install the types as usual from `@types/react` and `@types/react-dom`. Until the stable release, the types are available in different packages which need to be enforced in your `package.json`:
82
+
If you're using TypeScript, you also need to update the types.
These new APIs improve on `renderToString` by waiting for data to load for static HTML generation. They are designed to work with streaming environments like Node.js Streams and Web Streams. For example, in a Web Stream environment, you can prerender a React tree to static HTML with `prerender`:
334
+
335
+
```js
336
+
import { prerender } from'react-dom/static';
337
+
338
+
asyncfunctionhandler(request) {
339
+
const {prelude} =awaitprerender(<App />, {
340
+
bootstrapScripts: ['/main.js']
341
+
});
342
+
returnnewResponse(prelude, {
343
+
headers: { 'content-type':'text/html' },
344
+
});
345
+
}
346
+
```
347
+
348
+
Prerender APIs will wait for all data to load before returning the static HTML stream. Streams can be converted to strings, or sent with a streaming response. They do not support streaming content as it loads, which is supported by the existing [React DOM server rendering APIs](/reference/react-dom/server).
349
+
350
+
For more information, see [React DOM Static APIs](/reference/react-dom/static).
0 commit comments