Skip to content

Commit cf20b20

Browse files
authored
Merge pull request #56 from reactjs/sync-c3bc5aff
2 parents a64299a + 3743ff3 commit cf20b20

File tree

15 files changed

+389
-109
lines changed

15 files changed

+389
-109
lines changed

src/components/Layout/Page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {useRouter} from 'next/router';
88
import {SidebarNav} from './SidebarNav';
99
import {Footer} from './Footer';
1010
import {Toc} from './Toc';
11-
import SocialBanner from '../SocialBanner';
11+
// import SocialBanner from '../SocialBanner';
1212
import {DocsPageFooter} from 'components/DocsFooter';
1313
import {Seo} from 'components/Seo';
1414
import PageHeading from 'components/PageHeading';
@@ -137,7 +137,7 @@ export function Page({
137137
/>
138138
</Head>
139139
)}
140-
<SocialBanner />
140+
{/*<SocialBanner />*/}
141141
<TopNav
142142
section={section}
143143
routeTree={routeTree}

src/components/Layout/TopNav/TopNav.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function NavItem({url, isActive, children}: any) {
125125
<Link
126126
href={url}
127127
className={cn(
128-
'active:scale-95 transition-transform w-full text-center outline-link py-1.5 px-1.5 xs:px-3 sm:px-4 rounded-full capitalize',
128+
'active:scale-95 transition-transform w-full text-center outline-link py-1.5 px-1.5 xs:px-3 sm:px-4 rounded-full capitalize whitespace-nowrap',
129129
!isActive && 'hover:bg-primary/5 hover:dark:bg-primary-dark/5',
130130
isActive &&
131131
'bg-highlight dark:bg-highlight-dark text-link dark:text-link-dark'

src/components/PageHeading.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function PageHeading({
2222
title,
2323
status,
2424
canary,
25-
description,
2625
tags = [],
2726
breadcrumbs,
2827
}: PageHeadingProps) {
@@ -40,11 +39,6 @@ function PageHeading({
4039
)}
4140
{status ? <em>{status}</em> : ''}
4241
</H1>
43-
{description && (
44-
<p className="mt-4 mb-6 dark:text-primary-dark text-xl text-primary leading-large">
45-
{description}
46-
</p>
47-
)}
4842
{tags?.length > 0 && (
4943
<div className="mt-4">
5044
{tags.map((tag) => (

src/content/blog/2024/04/25/react-19-upgrade-guide.md

+79-21
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
---
2-
title: "React 19 Beta Upgrade Guide"
2+
title: "React 19 RC Upgrade Guide"
33
author: Ricky Hanlon
44
date: 2024/04/25
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 libraries to React 19 beta.
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.
66
---
77

88
April 25, 2024 by [Ricky Hanlon](https://twitter.com/rickhanlonii)
99

1010
---
1111

12-
<Note>
13-
14-
This beta release is for libraries to prepare for React 19. App developers should upgrade to 18.3.0 and wait for React 19 stable as we work with libraries and make changes based on feedback.
15-
16-
</Note>
17-
1812

1913
<Intro>
2014

21-
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.
22-
23-
To help make the upgrade easier, today we are also publishing React 18.3.
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.
2416

2517
</Intro>
2618

@@ -36,16 +28,17 @@ For a list of changes in 18.3 see the [Release Notes](https://github.com/faceboo
3628

3729
</Note>
3830

39-
In this post, we will guide you through the steps for upgrading libraries to React 19 beta:
31+
In this post, we will guide you through the steps for upgrading to React 19:
4032

4133
- [Installing](#installing)
34+
- [Codemods](#codemods)
4235
- [Breaking changes](#breaking-changes)
4336
- [New deprecations](#new-deprecations)
4437
- [Notable changes](#notable-changes)
4538
- [TypeScript changes](#typescript-changes)
4639
- [Changelog](#changelog)
4740

48-
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 beta, 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/04/25/react-19).
4942

5043
---
5144
## Installing {/*installing*/}
@@ -77,26 +70,57 @@ We expect most apps will not be affected since the transform is enabled in most
7770
To install the latest version of React and React DOM:
7871

7972
```bash
80-
npm install react@beta react-dom@beta
73+
npm install react@rc react-dom@rc
8174
```
8275

83-
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`. During the beta period, the types are available in different packages which need to be enforced in your `package.json`:
76+
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`:
8477

8578
```json
8679
{
8780
"dependencies": {
88-
"@types/react": "npm:types-react@beta",
89-
"@types/react-dom": "npm:types-react-dom@beta"
81+
"@types/react": "npm:types-react@rc",
82+
"@types/react-dom": "npm:types-react-dom@rc"
9083
},
9184
"overrides": {
92-
"@types/react": "npm:types-react@beta",
93-
"@types/react-dom": "npm:types-react-dom@beta"
85+
"@types/react": "npm:types-react@rc",
86+
"@types/react-dom": "npm:types-react-dom@rc"
9487
}
9588
}
9689
```
9790

9891
We're also including a codemod for the most common replacements. See [TypeScript changes](#typescript-changes) below.
9992

93+
## Codemods {/*codemods*/}
94+
95+
To help with the upgrade, we've worked with the team at [codemod.com](https://codemod.com) to publish codemods that will automatically update your code to many of the new APIs and patterns in React 19.
96+
97+
All codemods are available in the [`react-codemod` repo](https://github.com/reactjs/react-codemod) and the Codemod team have joined in helping maintain the codemods. To run these codemods, we recommend using the `codemod` command instead of the `react-codemod` because it runs faster, handles more complex code migrations, and provides better support for TypeScript.
98+
99+
100+
<Note>
101+
102+
#### Run all React 19 codemods {/*run-all-react-19-codemods*/}
103+
104+
Run all codemods listed in this guide with the React 19 `codemod` recipe:
105+
106+
```bash
107+
npx codemod@latest react/19/migration-recipe
108+
```
109+
110+
This will run the following codemods from `react-codemod`:
111+
- [`replace-reactdom-render`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-reactdom-render)
112+
- [`replace-string-ref`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-string-ref)
113+
- [`replace-act-import`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-act-import)
114+
- [`replace-use-form-state`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-use-form-state)
115+
- [`prop-types-typescript`](TODO)
116+
117+
This does not include the TypeScript changes. See [TypeScript changes](#typescript-changes) below.
118+
119+
</Note>
120+
121+
Changes that include a codemod include the command below.
122+
123+
For a list of all available codemods, see the [`react-codemod` repo](https://github.com/reactjs/react-codemod).
100124

101125
## Breaking changes {/*breaking-changes*/}
102126

@@ -128,7 +152,7 @@ For more info, see the docs for [`createRoot`](https://react.dev/reference/react
128152
### Removed deprecated React APIs {/*removed-deprecated-react-apis*/}
129153

130154
#### Removed: `propTypes` and `defaultProps` for functions {/*removed-proptypes-and-defaultprops*/}
131-
`PropTypes` were deprecated in [April 2017 (v15.5.0)](https://legacy.reactjs.org/blog/2017/04/07/react-v15.5.0.html#new-deprecation-warnings).
155+
`PropTypes` were deprecated in [April 2017 (v15.5.0)](https://legacy.reactjs.org/blog/2017/04/07/react-v15.5.0.html#new-deprecation-warnings).
132156

133157
In React 19, we're removing the `propType` checks from the React package, and using them will be silently ignored. If you're using `propTypes`, we recommend migrating to TypeScript or another type-checking solution.
134158

@@ -158,6 +182,16 @@ function Heading({text = 'Hello, world!'}: Props) {
158182
}
159183
```
160184

185+
<Note>
186+
187+
Codemod `propTypes` to TypeScript with:
188+
189+
```bash
190+
npx codemod@latest react/prop-types-typescript
191+
```
192+
193+
</Note>
194+
161195
#### Removed: Legacy Context using `contextTypes` and `getChildContext` {/*removed-removing-legacy-context*/}
162196

163197
Legacy Context was deprecated in [October 2018 (v16.6.0)](https://legacy.reactjs.org/blog/2018/10/23/react-v-16-6.html).
@@ -253,7 +287,11 @@ class MyComponent extends React.Component {
253287

254288
<Note>
255289

256-
To help with the migration, we will be publishing a [react-codemod](https://github.com/reactjs/react-codemod/#string-refs) to automatically replace string refs with `ref` callbacks. Follow [this PR](https://github.com/reactjs/react-codemod/pull/309) for updates and to try it out.
290+
Codemod string refs with `ref` callbacks:
291+
292+
```bash
293+
npx codemod@latest react/19/replace-string-ref
294+
```
257295

258296
</Note>
259297

@@ -340,6 +378,16 @@ All other `test-utils` functions have been removed. These utilities were uncommo
340378

341379
See the [warning page](https://react.dev/warnings/react-dom-test-utils) for alternatives.
342380

381+
<Note>
382+
383+
Codemod `ReactDOMTestUtils.act` to `React.act`:
384+
385+
```bash
386+
npx codemod@latest react/19/replace-act-import
387+
```
388+
389+
</Note>
390+
343391
#### Removed: `ReactDOM.render` {/*removed-reactdom-render*/}
344392

345393
`ReactDOM.render` was deprecated in [March 2022 (v18.0.0)](https://react.dev/blog/2022/03/08/react-18-upgrade-guide). In React 19, we're removing `ReactDOM.render` and you'll need to migrate to using [`ReactDOM.createRoot`](https://react.dev/reference/react-dom/client/createRoot):
@@ -355,6 +403,16 @@ const root = createRoot(document.getElementById('root'));
355403
root.render(<App />);
356404
```
357405

406+
<Note>
407+
408+
Codemod `ReactDOM.render` to `ReactDOM.createRoot`:
409+
410+
```bash
411+
npx codemod@latest react/19/replace-reactdom-render
412+
```
413+
414+
</Note>
415+
358416
#### Removed: `ReactDOM.hydrate` {/*removed-reactdom-hydrate*/}
359417

360418
`ReactDOM.hydrate` was deprecated in [March 2022 (v18.0.0)](https://react.dev/blog/2022/03/08/react-18-upgrade-guide). In React 19, we're removing `ReactDOM.hydrate` you'll need to migrate to using [`ReactDOM.hydrateRoot`](https://react.dev/reference/react-dom/client/hydrateRoot),

src/content/blog/2024/04/25/react-19.md

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
---
2-
title: "React 19 Beta"
2+
title: "React 19 RC"
33
author: The React Team
44
date: 2024/04/25
5-
description: React 19 Beta is now available on npm! In this post, we'll give an overview of the new features in React 19, and how you can adopt them.
5+
description: React 19 RC is now available on npm! In this post, we'll give an overview of the new features in React 19, and how you can adopt them.
66
---
77

88
April 25, 2024 by [The React Team](/community/team)
99

1010
---
1111

12-
<Note>
13-
14-
This beta release is for libraries to prepare for React 19. App developers should upgrade to 18.3.0 and wait for React 19 stable as we work with libraries and make changes based on feedback.
15-
16-
</Note>
17-
1812
<Intro>
1913

20-
React 19 Beta is now available on npm!
14+
React 19 RC is now available on npm!
2115

2216
</Intro>
2317

24-
In our [React 19 Beta Upgrade Guide](/blog/2024/04/25/react-19-upgrade-guide), we shared step-by-step instructions for upgrading your app to React 19 Beta. In this post, we'll give an overview of the new features in React 19, and how you can adopt them.
18+
In our [React 19 RC Upgrade Guide](/blog/2024/04/25/react-19-upgrade-guide), we shared step-by-step instructions for upgrading your app to React 19. In this post, we'll give an overview of the new features in React 19, and how you can adopt them.
2519

2620
- [What's new in React 19](#whats-new-in-react-19)
2721
- [Improvements in React 19](#improvements-in-react-19)
@@ -510,8 +504,7 @@ Due to the introduction of ref cleanup functions, returning anything else from a
510504

511505
The original code returned the instance of the `HTMLDivElement` and TypeScript wouldn't know if this was _supposed_ to be a cleanup function or if you didn't want to return a cleanup function.
512506

513-
You can codemod this pattern with [`no-implicit-ref-callback-return
514-
`](https://github.com/eps1lon/types-react-codemod/#no-implicit-ref-callback-return).
507+
You can codemod this pattern with [`no-implicit-ref-callback-return`](https://github.com/eps1lon/types-react-codemod/#no-implicit-ref-callback-return).
515508

516509
### `useDeferredValue` initial value {/*use-deferred-value-initial-value*/}
517510

0 commit comments

Comments
 (0)