Skip to content

Sync with react.dev @ a3e9466d #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0bc6300
[ci] fix notify for forks (#7694)
rickhanlonii Mar 24, 2025
9b2ad17
[ci] Remove unused param (#7695)
poteto Mar 24, 2025
6788f6b
Fixes typo (#7688)
betovelandia Mar 24, 2025
2859efa
Add React Prague community (#7279)
pchalupa Mar 25, 2025
9f87530
Remove captureOwnerStack canary banner (#7701)
jackpope Mar 31, 2025
38ee8d2
Add note about StrictMode not as the root component (#7702)
rickhanlonii Mar 31, 2025
c0e1774
[errors] special case for 418 (#7705)
rickhanlonii Apr 1, 2025
b5f5134
update reactrouter url (#7703)
zongben Apr 1, 2025
06500ec
Typo correction (#7657)
SandwichGouda Apr 2, 2025
6a548a8
Use stable React by default in Sandpacks (#7709)
eps1lon Apr 2, 2025
b77c05d
Misc `captureOwnerStack` cleanup after stable release (#7710)
eps1lon Apr 2, 2025
b5c16dc
fix(reference): declare `subscribe` before passing it to the hook (#7…
hugmouse Apr 2, 2025
3dfa3bd
Fix heading links in StrictMode (#7713)
rickhanlonii Apr 2, 2025
9fc1221
Update meetups.md (#7700)
darshanyeah Apr 2, 2025
c74271e
Add React Denver to the Meetups page (#4727)
willklein Apr 2, 2025
0ea503b
typo (#7685)
pdurbin Apr 2, 2025
5138e60
Fix small grammatical mistake on Reusing Logic with Custom Hooks page…
LuckyT89 Apr 2, 2025
6ead1fa
Add note about `useId` being allowed in non-async Server Components (…
hernan-yadiel Apr 7, 2025
e148ffe
Add note about root.render microtask scheduling (#7717)
jukben Apr 8, 2025
420c2f6
Add React Conf banner (#7729)
mattcarrollcode Apr 8, 2025
5598696
Add React Conf to conferences.md and move past conferences (#7730)
mattcarrollcode Apr 9, 2025
3c805e7
fix(reference): missing parameter in hydrateRoot (#7724)
Kafuu-Chinocya Apr 15, 2025
84261aa
Update versions to mention the latest version: 19.1 (#7739)
val1984 Apr 15, 2025
947681e
docs: fix a typo in the docs (#7736)
Clatron Apr 15, 2025
4bea66b
Change the word 'Function' to 'Component' (#7741)
kapantzak Apr 16, 2025
4c54ac9
Fix missing Sunsetting CRA entry in sidebar (#7755)
poteto Apr 21, 2025
3a88efd
Compiler blog post (#7756)
poteto Apr 21, 2025
c1e5681
Compiler blog post edits (#7758)
poteto Apr 21, 2025
663df77
React compiler doc updates (#7759)
poteto Apr 21, 2025
740016e
More compiler blog post tweaks (#7760)
poteto Apr 21, 2025
39b9c56
Fix ESLint plugin version. (#7768)
cpojer Apr 23, 2025
5890bd6
Update react-compiler-rc.md (#7769)
poteto Apr 23, 2025
dd129e4
fix a typo in name in the blog post (#7762)
witch-factory Apr 23, 2025
55ddaa4
Add React Summit US 2025 and React Advanced London 2025 to conference…
Hlebread Apr 23, 2025
358d2be
[blog + docs] React Labs: View Transitions, Activity, and more (#7772)
rickhanlonii Apr 23, 2025
09c9593
Update Next.js deployment notes (#7771)
eduardoboucas Apr 23, 2025
159df67
Add React Norway 2025 conference to community page (#7766)
danisal Apr 24, 2025
f94ab10
Fix typos in blog post
sophiebits Apr 24, 2025
594ff45
Refine wording for Next.js + Compiler + SWC (#7779)
eps1lon Apr 25, 2025
d05547b
fix: server-components link in few pages (#7780)
ad1992 Apr 26, 2025
ecf7596
docs: rename unstableViewTransition to unstable_ViewTransition (#7778)
nickwlker Apr 27, 2025
92dfd8c
fixed typo (#7785)
MrD9877 Apr 28, 2025
022e047
Remove extra copy of labs post (#7787)
jackpope Apr 28, 2025
4314b49
Improve grammar in component descriptions (#7788)
Maddily Apr 29, 2025
d6c4c0f
Fix useOptimistic example (#7792)
rickhanlonii Apr 29, 2025
a3e9466
fix action pattern in useTransition / useOptimistic (#7796)
rickhanlonii Apr 30, 2025
e78897a
merging all conflicts
react-translations-bot May 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/discord_notify.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Discord Notify

on:
pull_request:
pull_request_target:
types: [opened, ready_for_review]

permissions: {}
Expand All @@ -14,7 +14,6 @@ jobs:
contents: read
with:
actor: ${{ github.event.pull_request.user.login }}
is_remote: true

notify:
if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/label_core_team_prs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Label Core Team PRs

on:
pull_request:
pull_request_target:

permissions: {}

Expand All @@ -18,7 +18,6 @@ jobs:
contents: read
with:
actor: ${{ github.event.pull_request.user.login }}
is_remote: true

label:
if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ module.exports = {
},
},
},
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
6 changes: 4 additions & 2 deletions public/js/jsfiddle-integration-babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

// Do not delete or move this file.
// Many fiddles reference it so we have to keep it here.
(function() {
(function () {
var tag = document.querySelector(
'script[type="application/javascript;version=1.7"]'
);
if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
alert(
'Bad JSFiddle configuration, please fork the original React JSFiddle'
);
}
tag.setAttribute('type', 'text/babel');
tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
Expand Down
6 changes: 4 additions & 2 deletions public/js/jsfiddle-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

// Do not delete or move this file.
// Many fiddles reference it so we have to keep it here.
(function() {
(function () {
var tag = document.querySelector(
'script[type="application/javascript;version=1.7"]'
);
if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
alert(
'Bad JSFiddle configuration, please fork the original React JSFiddle'
);
}
tag.setAttribute('type', 'text/jsx;harmony=true');
tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
Expand Down
4 changes: 2 additions & 2 deletions scripts/headingIDHelpers/walk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const fs = require('fs');

module.exports = function walk(dir) {
let results = [];
/**
/**
* If the param is a directory we can return the file
*/
if(dir.includes('md')){
if (dir.includes('md')) {
return [dir];
}
const list = fs.readdirSync(dir);
Expand Down
4 changes: 2 additions & 2 deletions scripts/headingIdLinter.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const validateHeaderIds = require('./headingIDHelpers/validateHeadingIDs');
const generateHeadingIds = require('./headingIDHelpers/generateHeadingIDs');

/**
/**
* yarn lint-heading-ids --> Checks all files and causes an error if heading ID is missing
* yarn lint-heading-ids --fix --> Fixes all markdown file's heading IDs
* yarn lint-heading-ids path/to/markdown.md --> Checks that particular file for missing heading ID (path can denote a directory or particular file)
* yarn lint-heading-ids --fix path/to/markdown.md --> Fixes that particular file's markdown IDs (path can denote a directory or particular file)
*/
*/

const markdownPaths = process.argv.slice(2);
if (markdownPaths.includes('--fix')) {
Expand Down
38 changes: 38 additions & 0 deletions src/components/Icon/IconExperimental.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/

import {memo} from 'react';

export const IconExperimental = memo<
JSX.IntrinsicElements['svg'] & {title?: string; size?: 's' | 'md'}
>(function IconCanary(
{className, title, size} = {
className: undefined,
title: undefined,
size: 'md',
}
) {
return (
<svg
className={className}
width={size === 's' ? '12px' : '20px'}
height={size === 's' ? '12px' : '20px'}
viewBox="0 0 20 20"
version="1.1"
xmlns="http://www.w3.org/2000/svg">
{title && <title>{title}</title>}
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
id="noun-labs-1201738-(2)"
transform="translate(2, 0)"
fill="currentColor"
fillRule="nonzero">
<path
d="M10.2865804,5.55665262 L10.2865804,2.22331605 L10.8591544,2.22331605 C11.0103911,2.22244799 11.1551447,2.16342155 11.2617505,2.05914367 C11.3684534,1.95486857 11.4282767,1.81370176 11.4282767,1.66667106 L11.4282767,0.556642208 C11.4282767,0.40907262 11.3678934,0.26747526 11.2605218,0.16308627 C11.1531503,0.0587028348 11.0074938,0 10.8556998,0 L5.14338868,0 C4.9915947,0 4.84594391,0.0587028348 4.73856664,0.16308627 C4.63119507,0.267469704 4.57081178,0.40907262 4.57081178,0.556642208 L4.57081178,1.66667106 C4.57081178,1.81434899 4.63119507,1.95594912 4.73856664,2.06033811 C4.8459382,2.16472155 4.9915947,2.22331605 5.14338868,2.22331605 L5.71596273,2.22331605 L5.71596273,5.55665262 C5.71596273,8.38665538 2.97295619,9.88999017 0.651686904,15.5566623 C-0.0957823782,17.360053 -2.00560068,20 7.99951567,20 C18.004632,20 16.0948137,17.3600252 15.3507732,15.5566623 C13.0124432,9.88999017 10.2865804,8.38665538 10.2865804,5.55665262 Z M9.89570197,10.709991 C10.0921412,10.709991 10.2805515,10.7858383 10.4193876,10.9209301 C10.5583466,11.0559135 10.6363652,11.2390693 10.6363652,11.4300417 C10.6363652,11.6210141 10.5583466,11.8040698 10.4193876,11.9391533 C10.2805401,12.0741367 10.0921412,12.1499813 9.89570197,12.1499813 C9.6992627,12.1499813 9.51096673,12.074134 9.37201631,11.9391533 C9.23316875,11.8040615 9.15515307,11.6210141 9.15515307,11.4300417 C9.15515307,11.2390693 9.2331716,11.0559024 9.37201631,10.9209301 C9.57264221,10.7258996 9.61239426,10.709991 9.89570197,10.709991 Z M8.98919546,9.04212824 C9.09790709,9.14792278 9.15884755,9.29158681 9.1585213,9.44110085 C9.15829001,9.59073155 9.09678989,9.73407335 8.98763252,9.83954568 C8.87847514,9.945018 8.73069852,10.0039347 8.57678157,10.0033977 C8.42286747,10.0027392 8.27565088,9.94273467 8.16727355,9.83639845 C8.05900765,9.73006224 7.99873866,9.58628988 7.99963013,9.43664806 C8.00052304,9.28788403 8.0620221,9.14542556 8.17051087,9.04048101 C8.27911107,8.93555591 8.42599335,8.87663641 8.57913312,8.87663641 C8.73291864,8.87665585 8.88047525,8.93622535 8.98919546,9.04212824 Z M7.99965585,17.9999981 C4.91377349,17.9999981 3.29882839,17.7332867 2.51364277,17.4999976 C2.37780966,17.4476975 2.26954376,17.3439641 2.21396931,17.2125528 C2.15838628,17.0811499 2.16006066,16.9334692 2.21876871,16.8033858 C2.6144474,15.5921346 3.14916224,14.4280501 3.81316983,13.3333824 C5.980145,9.82337899 8.22941036,13.8867718 10.0980836,13.8867718 C11.9666996,13.8867718 11.4695868,12.1534924 12.1827971,13.3333824 C12.8511505,14.4269112 13.3916656,15.5896902 13.794259,16.8000524 C13.8533022,16.9322137 13.8537479,17.0822749 13.7952635,17.2147751 C13.7368889,17.3472613 13.6248314,17.4504531 13.4856467,17.5000531 C12.6833967,17.7332867 11.0855382,17.9999981 7.99965585,17.9999981 Z"
id="Shape"></path>
</g>
</g>
</svg>
);
});
10 changes: 5 additions & 5 deletions src/components/Layout/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {useRouter} from 'next/router';
import {SidebarNav} from './SidebarNav';
import {Footer} from './Footer';
import {Toc} from './Toc';
// import SocialBanner from '../SocialBanner';
import SocialBanner from '../SocialBanner';
import {DocsPageFooter} from 'components/DocsFooter';
import {Seo} from 'components/Seo';
import PageHeading from 'components/PageHeading';
Expand All @@ -31,7 +31,7 @@ interface PageProps {
meta: {
title?: string;
titleForTitleTag?: string;
canary?: boolean;
version?: 'experimental' | 'canary';
description?: string;
};
section: 'learn' | 'reference' | 'community' | 'blog' | 'home' | 'unknown';
Expand All @@ -53,7 +53,7 @@ export function Page({
routeTree
);
const title = meta.title || route?.title || '';
const canary = meta.canary || false;
const version = meta.version;
const description = meta.description || route?.description || '';
const isHomePage = cleanedPath === '/';
const isBlogIndex = cleanedPath === '/blog';
Expand All @@ -70,7 +70,7 @@ export function Page({
)}>
<PageHeading
title={title}
canary={canary}
version={version}
description={description}
tags={route?.tags}
breadcrumbs={breadcrumbs}
Expand Down Expand Up @@ -137,7 +137,7 @@ export function Page({
/>
</Head>
)}
{/*<SocialBanner />*/}
<SocialBanner />
<TopNav
section={section}
routeTree={routeTree}
Expand Down
11 changes: 9 additions & 2 deletions src/components/Layout/Sidebar/SidebarLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import * as React from 'react';
import cn from 'classnames';
import {IconNavArrow} from 'components/Icon/IconNavArrow';
import {IconCanary} from 'components/Icon/IconCanary';
import {IconExperimental} from 'components/Icon/IconExperimental';
import Link from 'next/link';

interface SidebarLinkProps {
href: string;
selected?: boolean;
title: string;
level: number;
version?: 'canary' | 'major';
version?: 'canary' | 'major' | 'experimental';
icon?: React.ReactNode;
isExpanded?: boolean;
hideArrow?: boolean;
Expand Down Expand Up @@ -84,7 +85,13 @@ export function SidebarLink({
)}
{version === 'canary' && (
<IconCanary
title=" - This feature is available in the latest Canary"
title=" - This feature is available in the latest Canary version of React"
className="ms-1 text-gray-30 dark:text-gray-60 inline-block w-3.5 h-3.5 align-[-3px]"
/>
)}
{version === 'experimental' && (
<IconExperimental
title=" - This feature is available in the latest Experimental version of React"
className="ms-1 text-gray-30 dark:text-gray-60 inline-block w-3.5 h-3.5 align-[-3px]"
/>
)}
Expand Down
29 changes: 17 additions & 12 deletions src/components/MDX/ErrorDecoder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function parseQueryString(search: string): Array<string | undefined> {
}

export default function ErrorDecoder() {
const {errorMessage} = useErrorDecoderParams();
const {errorMessage, errorCode} = useErrorDecoderParams();
/** error messages that contain %s require reading location.search */
const hasParams = errorMessage?.includes('%s');
const [message, setMessage] = useState<React.ReactNode | null>(() =>
Expand All @@ -82,23 +82,28 @@ export default function ErrorDecoder() {
if (errorMessage == null || !hasParams) {
return;
}
const args = parseQueryString(window.location.search);
let message = errorMessage;
if (errorCode === '418') {
// Hydration errors have a %s for the diff, but we don't add that to the args for security reasons.
message = message.replace(/%s$/, '');

setMessage(
urlify(
replaceArgs(
errorMessage,
parseQueryString(window.location.search),
'[missing argument]'
)
)
);
// Before React 19.1, the error message didn't have an arg, and was always HTML.
if (args.length === 0) {
args.push('HTML');
} else if (args.length === 1 && args[0] === '') {
args[0] = 'HTML';
}
}

setMessage(urlify(replaceArgs(message, args, '[missing argument]')));
setIsReady(true);
}, [hasParams, errorMessage]);
}, [errorCode, hasParams, errorMessage]);

return (
<code
className={cn(
'block bg-red-100 text-red-600 py-4 px-6 mt-5 rounded-lg',
'whitespace-pre-line block bg-red-100 text-red-600 py-4 px-6 mt-5 rounded-lg',
isReady ? 'opacity-100' : 'opacity-0'
)}>
<b>{message}</b>
Expand Down
10 changes: 10 additions & 0 deletions src/components/MDX/ExpandableCallout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type CalloutVariants =
| 'note'
| 'wip'
| 'canary'
| 'experimental'
| 'major'
| 'rsc';

Expand Down Expand Up @@ -51,6 +52,15 @@ const variantMap = {
overlayGradient:
'linear-gradient(rgba(245, 249, 248, 0), rgba(245, 249, 248, 1)',
},
experimental: {
title: 'Experimental Feature',
Icon: IconCanary,
containerClasses:
'bg-green-5 dark:bg-green-60 dark:bg-opacity-20 text-primary dark:text-primary-dark text-lg',
textColor: 'text-green-60 dark:text-green-40',
overlayGradient:
'linear-gradient(rgba(245, 249, 248, 0), rgba(245, 249, 248, 1)',
},
pitfall: {
title: '落とし穴',
Icon: IconPitfall,
Expand Down
20 changes: 20 additions & 0 deletions src/components/MDX/MDXComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ const Canary = ({children}: {children: React.ReactNode}) => (
<ExpandableCallout type="canary">{children}</ExpandableCallout>
);

const Experimental = ({children}: {children: React.ReactNode}) => (
<ExpandableCallout type="experimental">{children}</ExpandableCallout>
);

const NextMajor = ({children}: {children: React.ReactNode}) => (
<ExpandableCallout type="major">{children}</ExpandableCallout>
);
Expand All @@ -120,6 +124,20 @@ const CanaryBadge = ({title}: {title: string}) => (
</span>
);

const ExperimentalBadge = ({title}: {title: string}) => (
<span
title={title}
className={
'text-base font-display px-1 py-0.5 font-bold bg-gray-10 dark:bg-gray-60 text-gray-60 dark:text-gray-10 rounded'
}>
<IconCanary
size="s"
className={'inline me-1 mb-0.5 text-sm text-gray-60 dark:text-gray-10'}
/>
Experimental only
</span>
);

const NextMajorBadge = ({title}: {title: string}) => (
<span
title={title}
Expand Down Expand Up @@ -508,6 +526,8 @@ export const MDXComponents = {
MathI,
Note,
Canary,
Experimental,
ExperimentalBadge,
CanaryBadge,
NextMajor,
NextMajorBadge,
Expand Down
4 changes: 2 additions & 2 deletions src/components/MDX/Sandpack/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ root.render(
eject: 'react-scripts eject',
},
dependencies: {
react: '19.0.0-rc-3edc000d-20240926',
'react-dom': '19.0.0-rc-3edc000d-20240926',
react: '^19.1.0',
'react-dom': '^19.1.0',
'react-scripts': '^5.0.0',
},
},
Expand Down
17 changes: 13 additions & 4 deletions src/components/PageHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import {H1} from './MDX/Heading';
import type {RouteTag, RouteItem} from './Layout/getRouteMeta';
import * as React from 'react';
import {IconCanary} from './Icon/IconCanary';
import {IconExperimental} from './Icon/IconExperimental';

interface PageHeadingProps {
title: string;
canary?: boolean;
version?: 'experimental' | 'canary';
experimental?: boolean;
status?: string;
description?: string;
tags?: RouteTag[];
Expand All @@ -21,19 +23,26 @@ interface PageHeadingProps {
function PageHeading({
title,
status,
canary,
version,
tags = [],
breadcrumbs,
}: PageHeadingProps) {
console.log('version', version);
return (
<div className="px-5 sm:px-12 pt-3.5">
<div className="max-w-4xl ms-0 2xl:mx-auto">
{breadcrumbs ? <Breadcrumbs breadcrumbs={breadcrumbs} /> : null}
<H1 className="mt-0 text-primary dark:text-primary-dark -mx-.5 break-words">
{title}
{canary && (
{version === 'canary' && (
<IconCanary
title=" - This feature is available in the latest Canary"
title=" - This feature is available in the latest Canary version of React"
className="ms-4 mt-1 text-gray-50 dark:text-gray-40 inline-block w-6 h-6 align-[-1px]"
/>
)}
{version === 'experimental' && (
<IconExperimental
title=" - This feature is available in the latest Experimental version of React"
className="ms-4 mt-1 text-gray-50 dark:text-gray-40 inline-block w-6 h-6 align-[-1px]"
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SocialBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {useRef, useEffect} from 'react';
import cn from 'classnames';
import {ExternalLink} from './ExternalLink';

const bannerText = 'Stream React Conf on May 15-16.';
const bannerText = 'Join us for React Conf on Oct 7-8.';
const bannerLink = 'https://conf.react.dev/';
const bannerLinkText = 'Learn more.';

Expand Down
Loading
Loading