Skip to content

Commit fdb859b

Browse files
authored
Merge pull request #73 from reactjs/sync-69edd845 - React 19
Sync with react.dev @ 69edd84
2 parents a75d863 + 5a4dec6 commit fdb859b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2388
-3407
lines changed

src/components/Icon/IconRocket.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
import {memo} from 'react';
6+
7+
export const IconRocket = memo<
8+
JSX.IntrinsicElements['svg'] & {title?: string; size?: 's' | 'md'}
9+
>(function IconRocket({className, size = 'md'}) {
10+
return (
11+
<svg
12+
className={className}
13+
aria-hidden="true"
14+
width={size === 's' ? '1.2em' : '1.5em'}
15+
height={size === 's' ? '1.2em' : '1.5em'}
16+
fill="currentColor"
17+
version="1.1"
18+
viewBox="0 0 1200 1200"
19+
xmlns="http://www.w3.org/2000/svg">
20+
<g fillRule="evenodd">
21+
<path d="m911.8 288.2c65.051 65.051 65.051 170.6 0 235.65-65.051 65.051-170.6 65.051-235.65 0-65.051-65.051-65.051-170.6 0-235.65 65.051-65.051 170.6-65.051 235.65 0zm-53.051 53.051c-35.75-35.801-93.801-35.801-129.55 0-35.801 35.75-35.801 93.801 0 129.55 35.75 35.801 93.801 35.801 129.55 0 35.801-35.75 35.801-93.801 0-129.55z" />
22+
<path d="m1122.2 103.4s96.648 328.1-194.4 619.1c-130.75 130.75-303.25 226.75-440.75 250.5-12.102 2.0508-24.449-1.8984-33.102-10.648l-231.55-234.8c-8.6484-8.8008-12.449-21.301-10.102-33.398 26.102-135.4 135.45-292.2 265.2-421.95 291-291.05 619.1-194.4 619.1-194.4 12.352 3.6016 22 13.25 25.602 25.602zm-67.5 41.898c-70.898-12.898-308.6-35.602-524.15 179.9-112.35 112.35-210.4 245.4-240.4 364.25 0 0 203.05 205.9 203.1 205.9 121.75-26.852 268.4-112.75 381.55-225.9 215.5-215.55 192.8-453.25 179.9-524.15z" />
23+
<path d="m151.55 543.85 124 20.648c20.398 3.3984 34.25 22.75 30.801 43.148-3.3984 20.449-22.699 34.25-43.148 30.852l-144.35-24.051c-22.148-3.6992-40.699-18.949-48.602-40-7.9492-21.051-4.0508-44.699 10.199-62.148l122.85-150.15c15.051-18.398 36.898-30 60.551-32.148l179.55-16.301c20.602-1.8984 38.852 13.352 40.75 33.949 1.8516 20.602-13.352 38.852-33.949 40.75l-179.55 16.301c-3.6484 0.35156-7 2.1016-9.3008 4.9492z" />
24+
<path d="m656.15 1048.4 134.2-109.8c2.8516-2.3008 4.6016-5.6484 4.9492-9.3008l16.301-179.55c1.8984-20.602 20.148-35.801 40.75-33.949 20.602 1.8984 35.852 20.148 33.949 40.75l-16.301 179.55c-2.1484 23.648-13.75 45.5-32.148 60.551l-150.15 122.85c-17.449 14.25-41.102 18.148-62.148 10.199-21.051-7.8984-36.301-26.449-40-48.602l-29.25-175.7c-3.3984-20.398 10.398-39.75 30.801-43.148 20.449-3.3984 39.75 10.449 43.148 30.852l25.898 155.3z" />
25+
<path d="m310.9 560.4c-14.648-14.648-14.648-38.398 0-53.051 14.648-14.648 38.398-14.648 53.051 0l328.7 328.7c14.648 14.648 14.648 38.398 0 53.051-14.648 14.648-38.398 14.648-53.051 0z" />
26+
<path d="m383.95 982.15c14.648-14.602 38.398-14.602 53.051 0 14.602 14.648 14.602 38.398 0 53.051l-91.352 91.301c-14.602 14.648-38.398 14.648-53 0-14.648-14.602-14.648-38.398 0-53z" />
27+
<path d="m237.85 909.1c14.648-14.602 38.398-14.602 53.051 0 14.602 14.648 14.602 38.398 0 53.051l-127.85 127.85c-14.648 14.648-38.398 14.648-53.051 0-14.648-14.648-14.648-38.398 0-53.051z" />
28+
<path d="m164.8 763c14.648-14.602 38.398-14.602 53.051 0 14.602 14.648 14.602 38.398 0 53.051l-91.352 91.301c-14.602 14.648-38.398 14.648-53 0-14.648-14.602-14.648-38.398 0-53z" />
29+
</g>
30+
</svg>
31+
);
32+
});

src/components/Layout/Sidebar/SidebarLink.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface SidebarLinkProps {
1616
selected?: boolean;
1717
title: string;
1818
level: number;
19-
canary?: boolean;
19+
version?: 'canary' | 'major';
2020
icon?: React.ReactNode;
2121
isExpanded?: boolean;
2222
hideArrow?: boolean;
@@ -27,7 +27,7 @@ export function SidebarLink({
2727
href,
2828
selected = false,
2929
title,
30-
canary,
30+
version,
3131
level,
3232
isExpanded,
3333
hideArrow,
@@ -75,10 +75,17 @@ export function SidebarLink({
7575
{/* This here needs to be refactored ofc */}
7676
<div>
7777
{title}{' '}
78-
{canary && (
78+
{version === 'major' && (
79+
<span
80+
title="- This feature is available in React 19 beta and the React canary channel"
81+
className={`text-xs px-1 ms-1 rounded bg-gray-10 dark:bg-gray-40 dark:bg-opacity-20 text-gray-40 dark:text-gray-40`}>
82+
React 19
83+
</span>
84+
)}
85+
{version === 'canary' && (
7986
<IconCanary
8087
title=" - This feature is available in the latest Canary"
81-
className="ms-2 text-gray-30 dark:text-gray-60 inline-block w-4 h-4 align-[-3px]"
88+
className="ms-1 text-gray-30 dark:text-gray-60 inline-block w-3.5 h-3.5 align-[-3px]"
8289
/>
8390
)}
8491
</div>

src/components/Layout/Sidebar/SidebarRouteTree.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function SidebarRouteTree({
8787
path,
8888
title,
8989
routes,
90-
canary,
90+
version,
9191
heading,
9292
hasSectionHeader,
9393
sectionHeader,
@@ -121,7 +121,7 @@ export function SidebarRouteTree({
121121
selected={selected}
122122
level={level}
123123
title={title}
124-
canary={canary}
124+
version={version}
125125
isExpanded={isExpanded}
126126
hideArrow={isForceExpanded}
127127
/>
@@ -145,7 +145,7 @@ export function SidebarRouteTree({
145145
selected={selected}
146146
level={level}
147147
title={title}
148-
canary={canary}
148+
version={version}
149149
/>
150150
</li>
151151
);

src/components/Layout/getRouteMeta.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export type RouteTag =
1919
export interface RouteItem {
2020
/** Page title (for the sidebar) */
2121
title: string;
22-
/** Optional canary flag for heading */
23-
canary?: boolean;
22+
/** Optional version flag for heading */
23+
version?: 'canary' | 'major';
2424
/** Optional page description for heading */
2525
description?: string;
2626
/* Additional meta info for page tagging */

src/components/MDX/ExpandableCallout.tsx

+30-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ import {IconNote} from '../Icon/IconNote';
88
import {IconWarning} from '../Icon/IconWarning';
99
import {IconPitfall} from '../Icon/IconPitfall';
1010
import {IconCanary} from '../Icon/IconCanary';
11+
import {IconRocket} from '../Icon/IconRocket';
1112

12-
type CalloutVariants = 'deprecated' | 'pitfall' | 'note' | 'wip' | 'canary';
13+
type CalloutVariants =
14+
| 'deprecated'
15+
| 'pitfall'
16+
| 'note'
17+
| 'wip'
18+
| 'canary'
19+
| 'major'
20+
| 'rsc';
1321

1422
interface ExpandableCalloutProps {
1523
children: React.ReactNode;
@@ -59,6 +67,22 @@ const variantMap = {
5967
overlayGradient:
6068
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
6169
},
70+
major: {
71+
title: 'React 19',
72+
Icon: IconRocket,
73+
containerClasses: 'bg-blue-10 dark:bg-blue-60 dark:bg-opacity-20',
74+
textColor: 'text-blue-50 dark:text-blue-40',
75+
overlayGradient:
76+
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
77+
},
78+
rsc: {
79+
title: 'React Server Components',
80+
Icon: null,
81+
containerClasses: 'bg-blue-10 dark:bg-blue-60 dark:bg-opacity-20',
82+
textColor: 'text-blue-50 dark:text-blue-40',
83+
overlayGradient:
84+
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
85+
},
6286
};
6387

6488
function ExpandableCallout({children, type = 'note'}: ExpandableCalloutProps) {
@@ -72,9 +96,11 @@ function ExpandableCallout({children, type = 'note'}: ExpandableCalloutProps) {
7296
variant.containerClasses
7397
)}>
7498
<h3 className={cn('text-2xl font-display font-bold', variant.textColor)}>
75-
<variant.Icon
76-
className={cn('inline me-3 mb-1 text-lg', variant.textColor)}
77-
/>
99+
{variant.Icon && (
100+
<variant.Icon
101+
className={cn('inline me-2 mb-1 text-lg', variant.textColor)}
102+
/>
103+
)}
78104
{variant.title}
79105
</h3>
80106
<div className="relative">

src/components/MDX/MDXComponents.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ const Canary = ({children}: {children: React.ReactNode}) => (
9898
<ExpandableCallout type="canary">{children}</ExpandableCallout>
9999
);
100100

101+
const NextMajor = ({children}: {children: React.ReactNode}) => (
102+
<ExpandableCallout type="major">{children}</ExpandableCallout>
103+
);
104+
105+
const RSC = ({children}: {children: React.ReactNode}) => (
106+
<ExpandableCallout type="rsc">{children}</ExpandableCallout>
107+
);
108+
101109
const CanaryBadge = ({title}: {title: string}) => (
102110
<span
103111
title={title}
@@ -112,6 +120,26 @@ const CanaryBadge = ({title}: {title: string}) => (
112120
</span>
113121
);
114122

123+
const NextMajorBadge = ({title}: {title: string}) => (
124+
<span
125+
title={title}
126+
className={
127+
'text-base font-display px-2 py-0.5 font-bold bg-blue-10 dark:bg-blue-60 text-gray-60 dark:text-gray-10 rounded'
128+
}>
129+
React 19
130+
</span>
131+
);
132+
133+
const RSCBadge = ({title}: {title: string}) => (
134+
<span
135+
title={title}
136+
className={
137+
'text-base font-display px-2 py-0.5 font-bold bg-blue-10 dark:bg-blue-50 text-gray-60 dark:text-gray-10 rounded'
138+
}>
139+
RSC
140+
</span>
141+
);
142+
115143
const Blockquote = ({
116144
children,
117145
...props
@@ -486,6 +514,10 @@ export const MDXComponents = {
486514
Note,
487515
Canary,
488516
CanaryBadge,
517+
NextMajor,
518+
NextMajorBadge,
519+
RSC,
520+
RSCBadge,
489521
PackageImport,
490522
ReadBlogPost,
491523
Recap,

src/components/MDX/Sandpack/template.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ root.render(
2828
eject: 'react-scripts eject',
2929
},
3030
dependencies: {
31-
react: '^18.0.0',
32-
'react-dom': '^18.0.0',
31+
react: '19.0.0-rc-3edc000d-20240926',
32+
'react-dom': '19.0.0-rc-3edc000d-20240926',
3333
'react-scripts': '^5.0.0',
3434
},
3535
},

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

+15-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "React 19 RC Upgrade Guide"
2+
title: "React 19 Upgrade Guide"
33
author: Ricky Hanlon
44
date: 2024/04/25
55
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)
1212

1313
<Intro>
1414

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.
1616

1717
</Intro>
1818

@@ -38,7 +38,7 @@ In this post, we will guide you through the steps for upgrading to React 19:
3838
- [TypeScript changes](#typescript-changes)
3939
- [Changelog](#changelog)
4040

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).
4242

4343
---
4444
## Installing {/*installing*/}
@@ -70,28 +70,23 @@ We expect most apps will not be affected since the transform is enabled in most
7070
To install the latest version of React and React DOM:
7171

7272
```bash
73-
npm install --save-exact react@rc react-dom@rc
73+
npm install --save-exact react@^19.0.0 react-dom@^19.0.0
7474
```
7575

7676
Or, if you're using Yarn:
7777

7878
```bash
79-
yarn add --exact react@rc react-dom@rc
79+
yarn add --exact react@^19.0.0 react-dom@^19.0.0
8080
```
8181

82-
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.
83+
```bash
84+
npm install --save-exact @types/react@^19.0.0 @types/react-dom@^19.0.0
85+
```
8386

84-
```json
85-
{
86-
"dependencies": {
87-
"@types/react": "npm:types-react@rc",
88-
"@types/react-dom": "npm:types-react-dom@rc"
89-
},
90-
"overrides": {
91-
"@types/react": "npm:types-react@rc",
92-
"@types/react-dom": "npm:types-react-dom@rc"
93-
}
94-
}
87+
Or, if you're using Yarn:
88+
```bash
89+
yarn add --exact @types/react@^19.0.0 @types/react-dom@^19.0.0
9590
```
9691

9792
We're also including a codemod for the most common replacements. See [TypeScript changes](#typescript-changes) below.
@@ -735,12 +730,12 @@ const reducer = (state: State, action: Action) => state;
735730

736731
### Other breaking changes {/*other-breaking-changes*/}
737732

738-
- **react-dom**: Error for javascript URLs in src/href [#26507](https://github.com/facebook/react/pull/26507)
733+
- **react-dom**: Error for javascript URLs in `src` and `href` [#26507](https://github.com/facebook/react/pull/26507)
739734
- **react-dom**: Remove `errorInfo.digest` from `onRecoverableError` [#28222](https://github.com/facebook/react/pull/28222)
740735
- **react-dom**: Remove `unstable_flushControlled` [#26397](https://github.com/facebook/react/pull/26397)
741736
- **react-dom**: Remove `unstable_createEventHandle` [#28271](https://github.com/facebook/react/pull/28271)
742737
- **react-dom**: Remove `unstable_renderSubtreeIntoContainer` [#28271](https://github.com/facebook/react/pull/28271)
743-
- **react-dom**: Remove `unstable_runWithPrioirty` [#28271](https://github.com/facebook/react/pull/28271)
738+
- **react-dom**: Remove `unstable_runWithPriority` [#28271](https://github.com/facebook/react/pull/28271)
744739
- **react-is**: Remove deprecated methods from `react-is` [28224](https://github.com/facebook/react/pull/28224)
745740

746741
### Other notable changes {/*other-notable-changes*/}
@@ -752,7 +747,7 @@ const reducer = (state: State, action: Action) => state;
752747
- **react-dom**: Remove layout effect warning during SSR [#26395](https://github.com/facebook/react/pull/26395)
753748
- **react-dom**: Warn and dont set empty string for src/href (except anchor tags) [#28124](https://github.com/facebook/react/pull/28124)
754749

755-
We'll publish the full changelog with the stable release of React 19.
750+
For a full list of changes, please see the [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md#1900-december-5-2024).
756751

757752
---
758753

src/content/blog/2024/05/22/react-conf-2024-recap.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Last week we hosted React Conf 2024, a two-day conference in Henderson, Nevada w
1717

1818
---
1919

20-
At React Conf 2024, we announced the [React 19 RC](/blog/2024/04/25/react-19), the [React Native New Architecture Beta](https://github.com/reactwg/react-native-new-architecture/discussions/189), and an experimental release of the [React Compiler](/learn/react-compiler). The community also took the stage to announce [React Router v7](https://remix.run/blog/merging-remix-and-react-router), [Universal Server Components](https://www.youtube.com/watch?v=T8TZQ6k4SLE&t=20765s) in Expo Router, React Server Components in [RedwoodJS](https://redwoodjs.com/blog/rsc-now-in-redwoodjs), and much more.
20+
At React Conf 2024, we announced the [React 19 RC](/blog/2024/12/05/react-19), the [React Native New Architecture Beta](https://github.com/reactwg/react-native-new-architecture/discussions/189), and an experimental release of the [React Compiler](/learn/react-compiler). The community also took the stage to announce [React Router v7](https://remix.run/blog/merging-remix-and-react-router), [Universal Server Components](https://www.youtube.com/watch?v=T8TZQ6k4SLE&t=20765s) in Expo Router, React Server Components in [RedwoodJS](https://redwoodjs.com/blog/rsc-now-in-redwoodjs), and much more.
2121

2222
The entire [day 1](https://www.youtube.com/watch?v=T8TZQ6k4SLE) and [day 2](https://www.youtube.com/watch?v=0ckOUBiuxVY) streams are available online. In this post, we'll summarize the talks and announcements from the event.
2323

@@ -36,7 +36,7 @@ For more, check out these talks from the community later in the conference:
3636
- [RedwoodJS, now with React Server Components](https://www.youtube.com/watch?v=T8TZQ6k4SLE&t=26815s) by [Amy Dutton](https://twitter.com/selfteachme)
3737
- [Introducing Universal React Server Components in Expo Router](https://www.youtube.com/watch?v=T8TZQ6k4SLE&t=20765s) by [Evan Bacon](https://twitter.com/Baconbrix)
3838

39-
Next in the keynote, [Josh Story](https://twitter.com/joshcstory) and [Andrew Clark](https://twitter.com/acdlite) shared new features coming in React 19, and announced the React 19 RC which is ready for testing in production. Check out all the features in the [React 19 release post](/blog/2024/04/25/react-19), and see these talks for deep dives on the new features:
39+
Next in the keynote, [Josh Story](https://twitter.com/joshcstory) and [Andrew Clark](https://twitter.com/acdlite) shared new features coming in React 19, and announced the React 19 RC which is ready for testing in production. Check out all the features in the [React 19 release post](/blog/2024/12/05/react-19), and see these talks for deep dives on the new features:
4040

4141
- [What's new in React 19](https://www.youtube.com/watch?v=T8TZQ6k4SLE&t=8880s) by [Lydia Hallie](https://twitter.com/lydiahallie)
4242
- [React Unpacked: A Roadmap to React 19](https://www.youtube.com/watch?v=T8TZQ6k4SLE&t=10112s) by [Sam Selikoff](https://twitter.com/samselikoff)

0 commit comments

Comments
 (0)