Skip to content
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

Sync with react.dev @ 84f29eb2 #496

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6671ba7
Document behaviour of setting state inside `useLayoutEffect` (#7096)
OliverJAsh Aug 7, 2024
2bfa7a6
Update compiler docs installation instructions (#7095)
poteto Aug 8, 2024
a220bb3
docs: replace check mark emoji to check mark button emoji (#7121)
k35o Aug 22, 2024
b5f28b4
Redirect lists-and-keys to rendering-lists describing key (#7120)
BartoszKlonowski Aug 23, 2024
7d50c3f
Emphasize the second problem paragraph with chain of effects example …
BartoszKlonowski Aug 25, 2024
50004fa
Adds React Advanced London 2024 (#7127)
PixelsCommander Aug 26, 2024
40d7349
Parallel structure
sophiebits Aug 29, 2024
c2d6131
Fix typo 'bulit' -> 'built' (#7138)
tveastman Sep 1, 2024
391dadb
Fix typos in lazy.md and cache.md (#7141)
kihyeoon Sep 2, 2024
cd923d6
Update conferences.md to move the past conferences lower (#7130)
JiashengWu Sep 6, 2024
2c06272
add React Day Berlin 2024 to conferences.md (#7137)
McFrid Sep 6, 2024
60ef58c
Update conferences.md, add conference (#7135)
OlegKomissarov Sep 6, 2024
9aa2e36
Changed the documentation of the subscribe argument to a more accurat…
Tinttori Sep 8, 2024
0f2284d
Update copyright footer (#7152)
kassens Sep 9, 2024
13a73c1
Update the version 3 (#7161)
imparth7 Sep 16, 2024
505c85d
Update you-might-not-need-an-effect.md (#7169)
harish-sethuraman Sep 17, 2024
39abc60
Nit: server actions can't be passed events (#7175)
rickhanlonii Sep 19, 2024
c003ac4
Add stable fn notes to useMemo, useTransition, useState, and useReduc…
rickhanlonii Sep 22, 2024
e2f089d
Fix search results ranking and grouping (#7183)
rickhanlonii Sep 23, 2024
ec8f70f
rm insights prop to unbreak main
rickhanlonii Sep 23, 2024
8e6e81e
rm package-lock.json (#7184)
rickhanlonii Sep 23, 2024
8dba319
reactjsday-2024-Verona (#7171)
lxmarinkovic Sep 24, 2024
fe37c42
✨KOREAN(ko.react.dev) Translation Completed (#7185)
lumirlumir Sep 29, 2024
7e59348
Replace defunct placeKitten calls with loremFlicker and placeCat call…
pauljones0 Sep 30, 2024
a506983
chore(docs): fix typo (#7194)
bnzone Sep 30, 2024
8a62ce3
Add files via upload (#7182)
premdood Sep 30, 2024
ae9726a
Docs: Fix typos in thinking-in-react.md (#7179)
rammba Sep 30, 2024
6d2f337
Add React Native London Conf to the community conferences (#7173)
mojavad Sep 30, 2024
d418485
fix:#7158 issue (#7159)
imparth7 Sep 30, 2024
c7392cb
docs(act.md): correct ReactDOM to ReactDOMClient (#7156)
regchiu Sep 30, 2024
4436422
chore(typo): Fix comment to match code (#7147)
ssan93 Sep 30, 2024
7a8e256
Fix minor grammar issue in tutorial-tic-tac-toe.md (`a` to `an`) (#7136)
FarisPalayi Sep 30, 2024
4fe9c85
remove wrong reference of window (#7132)
youngvform Sep 30, 2024
8fee25f
Update renderToPipeableStream.md (#7131)
segmentationfaulter Sep 30, 2024
0f92834
fix: add missing blank lines between import statements and code block…
dev-satoshi Sep 30, 2024
ca2051f
fix: `@testing-library/react-native` links (#7124)
shubh73 Sep 30, 2024
d6df8eb
Add React Osaka to meetups (#7100)
martinheidegger Sep 30, 2024
d5aaa72
doc: Add missing return statement (#7081)
cst9221 Sep 30, 2024
589a1d3
doc: fix typo in updating-objects-in-state.md (#7077)
Rekl0w Sep 30, 2024
56b3832
Use correct link for translations progress site (#7199)
rammba Oct 1, 2024
1697ae8
fix: remove broken links in community/meetups (#7205)
juliogarciape Oct 3, 2024
bb38630
Add react-compiler-runtime instructions to compiler docs (#7213)
poteto Oct 7, 2024
2b2d0f2
`useActionState` pending example (#6989)
JakeSaterlay Oct 8, 2024
2bd6189
Capitalize "Effect" (#7211)
smikitky Oct 14, 2024
ee09492
[compiler] Move React 17/18 section to its own subheading (#7230)
poteto Oct 17, 2024
9467bc5
[compiler] Add docs for Beta (#7231)
poteto Oct 18, 2024
8f6d6a9
[compiler] Remove section on healthcheck (#7239)
poteto Oct 21, 2024
d9e650f
Add React Compiler Beta Release post (#7240)
poteto Oct 21, 2024
e2b2b90
Fix capitalization of eslint (#7241)
poteto Oct 21, 2024
a3656c2
Add atproto-did (#7242)
rickhanlonii Oct 21, 2024
1bda70a
Add link to eslint configuration in compiler blog post (#7244)
poteto Oct 22, 2024
e628e5d
Add ESLint flat config example, fix ESLint name (#7246)
karlhorky Oct 23, 2024
eb174dd
Update components-and-hooks-must-be-pure.md (#7245)
Sanderand Oct 23, 2024
b4b33c4
Replace contributors dead link (#7272)
ynshung Nov 2, 2024
75e4d40
Add Bluesky as profile link option to team page + footer (#7273)
gaearon Nov 2, 2024
ab51439
Add poteto bsky (#7276)
poteto Nov 3, 2024
8201e7e
[ci] Speed up CI (#7277)
poteto Nov 3, 2024
b214f78
Update socials for Josh Story (#7282)
gnoff Nov 8, 2024
3246989
Compiler: Update link to Expo documentation (#7288)
Simek Nov 12, 2024
891b20c
Update socials for Josh Story (#7290)
gnoff Nov 13, 2024
1d1767f
fix: broken link of react-compiler reference to nextjs docs (#7285)
golamrabbiazad Nov 14, 2024
84f29eb
Update React 19 Upgrade Guide with pre-warming change (#7292)
rickhanlonii Nov 14, 2024
2a09788
merging all conflicts
react-translations-bot Nov 25, 2024
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
24 changes: 16 additions & 8 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,26 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: yarn
cache-dependency-path: yarn.lock

- name: Install dependencies
uses: bahmutov/[email protected]
- name: Restore cached node_modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}

- name: Install deps
run: yarn install --frozen-lockfile

- name: Restore next build
uses: actions/cache@v2
uses: actions/cache@v4
id: restore-build-cache
env:
cache-name: cache-next-build
Expand All @@ -41,7 +49,7 @@ jobs:
run: npx -p [email protected] report

- name: Upload bundle
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: .next/analyze/__bundle_analysis.json
name: bundle_analysis.json
Expand Down Expand Up @@ -73,7 +81,7 @@ jobs:
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare

- name: Upload analysis comment
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: analysis_comment.txt
path: .next/analyze/__bundle_analysis_comment.txt
Expand All @@ -82,7 +90,7 @@ jobs:
run: echo ${{ github.event.number }} > ./pr_number

- name: Upload PR number
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: pr_number
path: ./pr_number
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/site_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ jobs:
name: Lint on node 20.x and ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
cache-dependency-path: yarn.lock

- name: Install deps and build (with cache)
uses: bahmutov/[email protected]
- name: Restore cached node_modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}

- name: Install deps
run: yarn install --frozen-lockfile

- name: Lint codebase
run: yarn ci-check
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
},
"dependencies": {
"@codesandbox/sandpack-react": "2.13.5",
"@docsearch/css": "3.0.0-alpha.41",
"@docsearch/react": "3.0.0-alpha.41",
"@docsearch/css": "^3.6.1",
"@docsearch/react": "^3.6.1",
"@headlessui/react": "^1.7.0",
"@radix-ui/react-context-menu": "^2.1.5",
"body-scroll-lock": "^3.1.3",
Expand Down
1 change: 1 addition & 0 deletions public/.well-known/atproto-did
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
did:plc:uorpbnp2q32vuvyeruwauyhe
Binary file added public/images/docs/diagrams/prerender.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/docs/diagrams/prerender.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/docs/diagrams/prewarm.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/docs/diagrams/prewarm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/components/Icon/IconBsky.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/

import {memo} from 'react';

export const IconBsky = memo<JSX.IntrinsicElements['svg']>(function IconBsky(
props
) {
return (
<svg
aria-label="Bluesky"
viewBox="0 0 16 16"
height="1.25em"
width="1.25em"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
{...props}>
<path
className="x19hqcy"
d="M3.468 1.948C5.303 3.325 7.276 6.118 8 7.616c.725-1.498 2.697-4.29 4.532-5.668C13.855.955 16 .186 16 2.632c0 .489-.28 4.105-.444 4.692-.572 2.04-2.653 2.561-4.504 2.246 3.236.551 4.06 2.375 2.281 4.2-3.376 3.464-4.852-.87-5.23-1.98-.07-.204-.103-.3-.103-.218 0-.081-.033.014-.102.218-.379 1.11-1.855 5.444-5.231 1.98-1.778-1.825-.955-3.65 2.28-4.2-1.85.315-3.932-.205-4.503-2.246C.28 6.737 0 3.12 0 2.632 0 .186 2.145.955 3.468 1.948Z"></path>
</svg>
);
});
9 changes: 8 additions & 1 deletion src/components/Layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import cn from 'classnames';
import {ExternalLink} from 'components/ExternalLink';
import {IconFacebookCircle} from 'components/Icon/IconFacebookCircle';
import {IconTwitter} from 'components/Icon/IconTwitter';
import {IconBsky} from 'components/Icon/IconBsky';
import {IconGitHub} from 'components/Icon/IconGitHub';

export function Footer() {
Expand Down Expand Up @@ -283,7 +284,7 @@ export function Footer() {
<div
className="text-xs text-left rtl:text-right mt-2 pe-0.5"
dir="ltr">
&copy;{new Date().getFullYear()}
Copyright &copy; Meta Platforms, Inc
</div>
<div
className="uwu-visible text-xs cursor-pointer hover:text-link hover:dark:text-link-dark hover:underline"
Expand Down Expand Up @@ -370,6 +371,12 @@ export function Footer() {
className={socialLinkClasses}>
<IconTwitter />
</ExternalLink>
<ExternalLink
aria-label="React on Bluesky"
href="https://bsky.app/profile/react.dev"
className={socialLinkClasses}>
<IconBsky />
</ExternalLink>
<ExternalLink
aria-label="React on Github"
href="https://github.com/facebook/react"
Expand Down
4 changes: 2 additions & 2 deletions src/components/MDX/Diagram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ interface DiagramProps {

function Caption({text}: {text: string}) {
return (
<div className="w-full table">
<figcaption className="p-1 sm:p-2 mt-0 sm:mt-0 text-gray-40 text-base lg:text-lg text-center leading-tight table-caption">
<div className="w-full flex justify-center">
<figcaption className="p-1 sm:p-2 mt-0 sm:mt-0 text-gray-40 text-base lg:text-lg text-center leading-tight table-caption max-w-lg">
{text}
</figcaption>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MDX/Sandpack/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function Preview({
/**
* The spinner component transition might be longer than
* the bundler loading, so we only show the spinner if
* it takes more than 1s to load the bundler.
* it takes more than 500s to load the bundler.
*/
timeout = setTimeout(() => {
setShowLoading(true);
Expand Down
20 changes: 17 additions & 3 deletions src/components/MDX/TeamMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as React from 'react';
import Image from 'next/image';
import {IconTwitter} from '../Icon/IconTwitter';
import {IconThreads} from '../Icon/IconThreads';
import {IconBsky} from '../Icon/IconBsky';
import {IconGitHub} from '../Icon/IconGitHub';
import {ExternalLink} from '../ExternalLink';
import {H3} from './Heading';
Expand All @@ -19,6 +20,7 @@ interface TeamMemberProps {
photo: string;
twitter?: string;
threads?: string;
bsky?: string;
github?: string;
personal?: string;
}
Expand All @@ -33,6 +35,7 @@ export function TeamMember({
github,
twitter,
threads,
bsky,
personal,
}: TeamMemberProps) {
if (name == null || title == null || permalink == null || children == null) {
Expand Down Expand Up @@ -62,11 +65,11 @@ export function TeamMember({
</H3>
{title && <div>{title}</div>}
{children}
<div className="sm:flex sm:flex-row flex-wrap">
<div className="sm:flex sm:flex-row flex-wrap text-secondary dark:text-secondary-dark">
{twitter && (
<div className="me-4">
<ExternalLink
aria-label="React on Twitter"
aria-label={`${name} on Twitter`}
href={`https://twitter.com/${twitter}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconTwitter className="pe-1" />
Expand All @@ -77,14 +80,25 @@ export function TeamMember({
{threads && (
<div className="me-4">
<ExternalLink
aria-label="React on Threads"
aria-label={`${name} on Threads`}
href={`https://threads.net/${threads}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconThreads className="pe-1" />
{threads}
</ExternalLink>
</div>
)}
{bsky && (
<div className="me-4">
<ExternalLink
aria-label={`${name} on Bluesky`}
href={`https://bsky.app/profile/${bsky}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconBsky className="pe-1" />
{bsky}
</ExternalLink>
</div>
)}
{github && (
<div className="me-4">
<ExternalLink
Expand Down
12 changes: 11 additions & 1 deletion src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@ export function Search({
onOpen,
onClose,
searchParameters = {
hitsPerPage: 5,
hitsPerPage: 30,
attributesToHighlight: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
],
},
}: SearchProps) {
useDocSearchKeyboardEvents({isOpen, onOpen, onClose});
Expand Down
4 changes: 2 additions & 2 deletions src/content/blog/2023/03/16/introducing-react-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Use the conditional operator (`cond ? a : b`) to render a ❌ if `isPacked` isn
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ export default function PackingList() {
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked ? '' : '❌'}
{name} {isPacked ? '' : '❌'}
</li>
);
}
Expand Down
22 changes: 20 additions & 2 deletions src/content/blog/2024/04/25/react-19-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ npm install react-shallow-renderer --save-dev

##### Please reconsider shallow rendering {/*please-reconsider-shallow-rendering*/}

Shallow rendering depends on React internals and can block you from future upgrades. We recommend migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started).
Shallow rendering depends on React internals and can block you from future upgrades. We recommend migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://testing-library.com/docs/react-native-testing-library/intro).

</Note>

Expand Down Expand Up @@ -524,7 +524,7 @@ We are deprecating `react-test-renderer` because it implements its own renderer

The test renderer was created before there were more viable testing strategies available like [React Testing Library](https://testing-library.com), and we now recommend using a modern testing library instead.

In React 19, `react-test-renderer` logs a deprecation warning, and has switched to concurrent rendering. We recommend migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience.
In React 19, `react-test-renderer` logs a deprecation warning, and has switched to concurrent rendering. We recommend migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://testing-library.com/docs/react-native-testing-library/intro) for a modern and well supported testing experience.

## Notable changes {/*notable-changes*/}

Expand All @@ -536,6 +536,24 @@ When double rendering in Strict Mode in development, `useMemo` and `useCallback`

As with all Strict Mode behaviors, these features are designed to proactively surface bugs in your components during development so you can fix them before they are shipped to production. For example, during development, Strict Mode will double-invoke ref callback functions on initial mount, to simulate what happens when a mounted component is replaced by a Suspense fallback.

### Improvements to Suspense {/*improvements-to-suspense*/}

In React 19, when a component suspends, React will immediately commit the fallback of the nearest Suspense boundary without waiting for the entire sibling tree to render. After the fallback commits, React schedules another render for the suspended siblings to "pre-warm" lazy requests in the rest of the tree:

<Diagram name="prerender" height={162} width={1270} alt="Diagram showing a tree of three components, one parent labeled Accordion and two children labeled Panel. Both Panel components contain isActive with value false.">

Previously, when a component suspended, the suspended siblings were rendered and then the fallback was committed.

</Diagram>

<Diagram name="prewarm" height={162} width={1270} alt="The same diagram as the previous, with the isActive of the first child Panel component highlighted indicating a click with the isActive value set to true. The second Panel component still contains value false." >

In React 19, when a component suspends, the fallback is committed and then the suspended siblings are rendered.

</Diagram>

This change means Suspense fallbacks display faster, while still warming lazy requests in the suspended tree.

### UMD builds removed {/*umd-builds-removed*/}

UMD was widely used in the past as a convenient way to load React without a build step. Now, there are modern alternatives for loading modules as scripts in HTML documents. Starting with React 19, React will no longer produce UMD builds to reduce the complexity of its testing and release process.
Expand Down
Loading
Loading