Skip to content

Sync with react.dev @ 50d6991c #999

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 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
73d7073
fix: correct overlay highlighting in code examples (#7669)
mrbadri May 15, 2025
4a7bdc1
fix: the value property of checkbox to the checked property (#7804)
kosh-jp May 16, 2025
ae4a40a
No need for useState here — useCounter handles the state internally (…
gbhardwaj00 May 16, 2025
a73055f
docs: fix misplaced prepositional phrase error (#7799)
mehmetmalli May 16, 2025
e2d9fd7
Fix wrong documentation for effect events (#7800)
gbhardwaj00 May 16, 2025
b92bb59
Remove stray console.log and image (#7814)
rickhanlonii May 16, 2025
b3b2166
fix(template): remove unnecessary import of React in template code (#…
dahoho May 16, 2025
9fb0519
fix(reference): correct singular form of 'Server Functions' to 'Serve…
dahoho May 16, 2025
69ce5d3
Add bold mono font (#7815)
rickhanlonii May 16, 2025
8b2fe2b
Remove TODO comments and convert them to issues (#7743)
BartoszKlonowski May 16, 2025
00587d6
Add example of `useActionState` handling execution order (#7733)
ajits01 May 16, 2025
79e1c48
docs: update vite link (#7784)
bornkiss May 16, 2025
c289cd0
docs: add bsky link (#7781)
bornkiss May 16, 2025
7ab1969
React Montreal Meetings have a new link (#7809)
EricCote May 16, 2025
f275c9d
fix: remove useless content (#6615)
loveloki May 17, 2025
0b68054
fix: wrong verb tense in doc (#7818)
aalhoura May 17, 2025
65d297e
fix: typo in challenge solution (#7816)
aalhoura May 17, 2025
f15830d
Use experiemental in all uEE doc sandboxes (#7820)
rickhanlonii May 20, 2025
2571aee
Author: Josh Story <story@hey.com>
gnoff May 21, 2025
3ee3a60
Fix wrong explanation in preserving-and-resetting-state (#6043)
smikitky May 26, 2025
9db23d6
fix: correct broken WAI-ARIA modal dialog link in createPortal refere…
dimatitov Jun 2, 2025
bbcb9af
Update meetups.md adding React Rajasthan Community (#7831)
shubhamui Jun 2, 2025
a2d17d1
Update components-and-hooks-must-be-pure.md (#7830)
ExercitusMortem Jun 2, 2025
94424ae
Update referencing-values-with-refs.md (#7829)
cHaLkdusT Jun 2, 2025
172f0b9
Add uwu click animation (#7822)
Jinsoo1004 Jun 2, 2025
3dcc4c4
Fix typo and clarily that a server function reference is created only…
kapantzak Jun 2, 2025
06965de
Add React Alicante 2025 to Conferences page (#7674)
mikedidomizio Jun 2, 2025
e901790
fix: use const where applicable in examples for keeping components pu…
ad1992 Jun 2, 2025
87cef4a
Remove `forwardRef` reference from API listing (#7837)
kassens Jun 3, 2025
c60173f
docs: Refactor context provider usage (#7793)
nannany Jun 3, 2025
37b09ea
fix: typo in docs on prerendering (#7823)
yeskunall Jun 3, 2025
5927c4e
Replace Context.Provider with Context (#7838)
kassens Jun 3, 2025
5dca520
fix(blog): resolve typo in React 19 blog post (`refs` → `ref`s) (#7828)
amir78729 Jun 3, 2025
50d6991
Update analyze_comment.yml (#7840)
jtn-dev Jun 6, 2025
61ac267
merging all conflicts
react-translations-bot Jun 16, 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
7 changes: 5 additions & 2 deletions .github/workflows/analyze_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ on:
types:
- completed

permissions: {}

permissions:
contents: read
issues: write
pull-requests: write

jobs:
comment:
runs-on: ubuntu-latest
Expand Down
Binary file added public/fonts/Source-Code-Pro-Bold.woff2
Binary file not shown.
Binary file modified public/fonts/Source-Code-Pro-Regular.woff2
Binary file not shown.
Binary file removed public/images/blog/react-labs-april-2025/flip.gif
Binary file not shown.
7 changes: 4 additions & 3 deletions src/components/Layout/HomeContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,8 @@ function ExampleLayout({
</div>
<div
ref={contentRef}
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center">
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center"
dir="ltr">
{right}
<div
className={cn(
Expand Down Expand Up @@ -1187,7 +1188,7 @@ async function Talks({ confId }) {
</CodeBlock>
}
right={
<NavContext.Provider value={{slug, navigate}}>
<NavContext value={{slug, navigate}}>
<BrowserChrome
domain="example.com"
path={'confs/' + slug}
Expand All @@ -1207,7 +1208,7 @@ async function Talks({ confId }) {
</Suspense>
</ExamplePanel>
</BrowserChrome>
</NavContext.Provider>
</NavContext>
}
/>
);
Expand Down
8 changes: 3 additions & 5 deletions src/components/Layout/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ export function Page({
'max-w-7xl mx-auto',
section === 'blog' && 'lg:flex lg:flex-col lg:items-center'
)}>
<TocContext.Provider value={toc}>
<LanguagesContext.Provider value={languages}>
{children}
</LanguagesContext.Provider>
</TocContext.Provider>
<TocContext value={toc}>
<LanguagesContext value={languages}>{children}</LanguagesContext>
</TocContext>
</div>
{!isBlogIndex && (
<DocsPageFooter
Expand Down
4 changes: 3 additions & 1 deletion src/components/Layout/TopNav/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ export default function TopNav({
<BrandMenu>
<div className="flex items-center">
<div className="uwu-visible flex items-center justify-center h-full">
<NextLink href="/">
<NextLink
href="/"
className="active:scale-95 transition-transform">
<Image
alt="logo by @sawaratsuki1004"
title="logo by @sawaratsuki1004"
Expand Down
4 changes: 2 additions & 2 deletions src/components/MDX/MDXComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function IllustrationBlock({
</figure>
));
return (
<IllustrationContext.Provider value={isInBlockTrue}>
<IllustrationContext value={isInBlockTrue}>
<div className="relative group before:absolute before:-inset-y-16 before:inset-x-0 my-16 mx-0 2xl:mx-auto max-w-4xl 2xl:max-w-6xl">
{sequential ? (
<ol className="mdx-illustration-block flex">
Expand All @@ -373,7 +373,7 @@ function IllustrationBlock({
)}
<AuthorCredit author={author} authorLink={authorLink} />
</div>
</IllustrationContext.Provider>
</IllustrationContext>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/MDX/Sandpack/template.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const template = {
'/src/index.js': {
hidden: true,
code: `import React, { StrictMode } from "react";
code: `import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./styles.css";

Expand Down
1 change: 0 additions & 1 deletion src/components/PageHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function PageHeading({
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">
Expand Down
9 changes: 8 additions & 1 deletion src/components/Seo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ export const Seo = withRouter(
)}
<link
rel="preload"
href="/fonts/Source-Code-Pro-Regular.woff2"
href="https://react.dev/fonts/Source-Code-Pro-Regular.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>
<link
rel="preload"
href="https://react.dev/fonts/Source-Code-Pro-Bold.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/2024/12/05/react-19.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ New function components will no longer need `forwardRef`, and we will be publish

<Note>

`refs` passed to classes are not passed as props since they reference the component instance.
`ref`s passed to classes are not passed as props since they reference the component instance.

</Note>

Expand Down
5 changes: 5 additions & 0 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ September 2-4, 2025. Wrocław, Poland.

[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)

### React Alicante 2025 {/*react-alicante-2025*/}
October 2-4, 2025. Alicante, Spain.

[Website](https://reactalicante.es/) - [Twitter](https://x.com/ReactAlicante) - [Bluesky](https://bsky.app/profile/reactalicante.es) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)

### React Conf 2025 {/*react-conf-2025*/}
October 7-8, 2025. Henderson, Nevada, USA and free livestream

Expand Down
4 changes: 4 additions & 0 deletions src/content/community/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ Cada comunidad está constituida por miles de usuarios de React.

## Noticias {/*news*/}

<<<<<<< HEAD
Para conocer las últimas noticias sobre React, [sigue **@reactjs** en Twitter](https://twitter.com/reactjs) y el [blog oficial de React](/blog/) en este sitio web.
=======
For the latest news about React, [follow **@reactjs** on Twitter](https://twitter.com/reactjs), [**@react.dev** on Bluesky](https://bsky.app/profile/react.dev) and the [official React blog](/blog/) on this website.
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
3 changes: 2 additions & 1 deletion src/content/community/meetups.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ title: Reuniones de React

## Canadá {/*canada*/}
* [Halifax, NS](https://www.meetup.com/Halifax-ReactJS-Meetup/)
* [Montreal, QC - React Native](https://www.meetup.com/fr-FR/React-Native-MTL/)
* [Montreal, QC](https://guild.host/react-montreal/)
* [Vancouver, BC](https://www.meetup.com/ReactJS-Vancouver-Meetup/)
* [Ottawa, ON](https://www.meetup.com/Ottawa-ReactJS-Meetup/)
* [Saskatoon, SK](https://www.meetup.com/saskatoon-react-meetup/)
Expand Down Expand Up @@ -88,6 +88,7 @@ title: Reuniones de React
* [Delhi NCR](https://www.meetup.com/React-Delhi-NCR/)
* [Mumbai](https://reactmumbai.dev)
* [Pune](https://www.meetup.com/ReactJS-and-Friends/)
* [Rajasthan](https://reactrajasthan.com)

## Indonesia {/*indonesia*/}
* [Indonesia](https://www.meetup.com/reactindonesia/)
Expand Down
7 changes: 7 additions & 0 deletions src/content/learn/build-a-react-app-from-scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,17 @@ De manera similar, si confías en que las aplicaciones usen tu framework para di

La división del código por rutas, cuando se integra con el empaquetamiento y la obtención de datos, puede reducir el tiempo de carga inicial de su aplicación y el tiempo que tarda en renderizarse el contenido visible más grande de la aplicación. ([Largest Contentful Paint](https://web.dev/articles/lcp?hl=es-419)).

<<<<<<< HEAD
Para obtener instrucciones sobre cómo dividir el código, consulte la documentación de su herramienta de compilación:
- [Optimizaciones de compilación](https://es.vite.dev/guide/features.html#optimizaciones-de-compilacion)
- [División de código con Parcel](https://parceljs.org/features/code-splitting/)
- [División de código con Rsbuild](https://rsbuild.dev/guide/optimization/code-splitting)
=======
For code-splitting instructions, see your build tool docs:
- [Vite build optimizations](https://vite.dev/guide/features.html#build-optimizations)
- [Parcel code splitting](https://parceljs.org/features/code-splitting/)
- [Rsbuild code splitting](https://rsbuild.dev/guide/optimization/code-splitting)
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91

### Mejorar el rendimiento de las aplicaciones {/*improving-application-performance*/}

Expand Down
41 changes: 32 additions & 9 deletions src/content/learn/keeping-components-pure.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function Cup({ guest }) {
}

export default function TeaGathering() {
let cups = [];
const cups = [];
for (let i = 1; i <= 12; i++) {
cups.push(<Cup key={i} guest={i} />);
}
Expand Down Expand Up @@ -245,7 +245,7 @@ Renderizar es un *cálculo*, no debería tratar de "hacer" cosas. ¿Puedes expre

```js src/Clock.js active
export default function Clock({ time }) {
let hours = time.getHours();
const hours = time.getHours();
if (hours >= 0 && hours <= 6) {
document.getElementById('time').className = 'night';
} else {
Expand Down Expand Up @@ -307,7 +307,7 @@ Puedes arreglar este componente calculando el `className` e incluirlo en la sali

```js src/Clock.js active
export default function Clock({ time }) {
let hours = time.getHours();
const hours = time.getHours();
let className;
if (hours >= 0 && hours <= 6) {
className = 'night';
Expand Down Expand Up @@ -606,14 +606,20 @@ export default function StoryTray({ stories }) {
import { useState, useEffect } from 'react';
import StoryTray from './StoryTray.js';

<<<<<<< HEAD
let initialStories = [
{id: 0, label: "Historia de Ankit" },
{id: 1, label: "Historia de Taylor" },
=======
const initialStories = [
{id: 0, label: "Ankit's Story" },
{id: 1, label: "Taylor's Story" },
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
];

export default function App() {
let [stories, setStories] = useState([...initialStories])
let time = useTime();
const [stories, setStories] = useState([...initialStories])
const time = useTime();

// PISTA: Evita que la memoria crezca por siempre mientras lees documentos.
// Estamos rompiendo nuestras propias reglas aquí.
Expand Down Expand Up @@ -702,14 +708,20 @@ export default function StoryTray({ stories }) {
import { useState, useEffect } from 'react';
import StoryTray from './StoryTray.js';

<<<<<<< HEAD
let initialStories = [
{id: 0, label: "Historia de Ankit" },
{id: 1, label: "Historia de Taylor" },
=======
const initialStories = [
{id: 0, label: "Ankit's Story" },
{id: 1, label: "Taylor's Story" },
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
];

export default function App() {
let [stories, setStories] = useState([...initialStories])
let time = useTime();
const [stories, setStories] = useState([...initialStories])
const time = useTime();

// PISTA: Evita que la memoria crezca por siempre mientras lees documentos.
// Estamos rompiendo nuestras propias reglas aquí.
Expand Down Expand Up @@ -769,8 +781,13 @@ Como alternativa, podrías crear un _nuevo_ array (copiando el existente) antes

```js src/StoryTray.js active
export default function StoryTray({ stories }) {
<<<<<<< HEAD
// ¡Copia el array!
let storiesToDisplay = stories.slice();
=======
// Copy the array!
const storiesToDisplay = stories.slice();
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91

// Esto no afecta al array original:
storiesToDisplay.push({
Expand All @@ -794,14 +811,20 @@ export default function StoryTray({ stories }) {
import { useState, useEffect } from 'react';
import StoryTray from './StoryTray.js';

<<<<<<< HEAD
let initialStories = [
{id: 0, label: "Historia de Ankit" },
{id: 1, label: "Historia de Taylor" },
=======
const initialStories = [
{id: 0, label: "Ankit's Story" },
{id: 1, label: "Taylor's Story" },
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
];

export default function App() {
let [stories, setStories] = useState([...initialStories])
let time = useTime();
const [stories, setStories] = useState([...initialStories])
const time = useTime();

// PISTA: Evita que la memoria crezca por siempre mientras lees documentos.
// Estamos rompiendo nuestras propias reglas aquí.
Expand Down
14 changes: 6 additions & 8 deletions src/content/learn/managing-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,9 @@ export default function Section({ children }) {
const level = useContext(LevelContext);
return (
<section className="section">
<LevelContext.Provider value={level + 1}>
<LevelContext value={level + 1}>
{children}
</LevelContext.Provider>
</LevelContext>
</section>
);
}
Expand Down Expand Up @@ -836,13 +836,11 @@ export function TasksProvider({ children }) {
);

return (
<TasksContext.Provider value={tasks}>
<TasksDispatchContext.Provider
value={dispatch}
>
<TasksContext value={tasks}>
<TasksDispatchContext value={dispatch}>
{children}
</TasksDispatchContext.Provider>
</TasksContext.Provider>
</TasksDispatchContext>
</TasksContext>
);
}

Expand Down
8 changes: 6 additions & 2 deletions src/content/learn/preserving-and-resetting-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,11 @@ label {

</Sandpack>

<<<<<<< HEAD
El estado del contador se reinicia cuando se hace clic en la casilla de verificación. Aunque se renderiza un `Counter`, el primer hijo del `div` cambia de `div` a `section`. Cuando el `div` hijo se eliminó del DOM, todo el árbol debajo de él (incluyendo el `Counter` y su estado) se destruyó también.
=======
The counter state gets reset when you click the checkbox. Although you render a `Counter`, the first child of the `div` changes from a `section` to a `div`. When the child `section` was removed from the DOM, the whole tree below it (including the `Counter` and its state) was destroyed as well.
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91

<DiagramGroup>

Expand Down Expand Up @@ -2011,7 +2015,7 @@ export default function ContactList() {
<label>
<input
type="checkbox"
value={reverse}
checked={reverse}
onChange={e => {
setReverse(e.target.checked)
}}
Expand Down Expand Up @@ -2110,7 +2114,7 @@ export default function ContactList() {
<label>
<input
type="checkbox"
value={reverse}
checked={reverse}
onChange={e => {
setReverse(e.target.checked)
}}
Expand Down
4 changes: 4 additions & 0 deletions src/content/learn/referencing-values-with-refs.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,11 @@ export default function Toggle() {

#### Arregla el _debounce_ {/*fix-debouncing*/}

<<<<<<< HEAD
En este ejemplo, todos los controladores de clic usan [el "corte de rebote" o _"debounce"_.](https://redd.one/blog/debounce-vs-throttle) Para ver que significa esto, presiona uno de los botones. Fíjate como el mensaje aparece un segundo después. Si presionas el botón mientras esperas el mensaje, el temporizador se reiniciará. Así que si te mantienes cliqueando el mismo botón rápidamente muchas veces, el mensaje no aparecerá hasta un segundo *después* de que pares de hacer clic. El _debounce_ te permite retrasar algunas acciones hasta que el usuario "pare de hacer cosas".
=======
In this example, all button click handlers are ["debounced".](https://kettanaito.com/blog/debounce-vs-throttle) To see what this means, press one of the buttons. Notice how the message appears a second later. If you press the button while waiting for the message, the timer will reset. So if you keep clicking the same button fast many times, the message won't appear until a second *after* you stop clicking. Debouncing lets you delay some action until the user "stops doing things".
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91

Este ejemplo funciona, pero no tan bien como se esperaba. Los botones no son independientes. Para ver el problema, haz clic en uno de los botones, y luego inmediatamente haz clic en otro botón. Esperarías que después de un retraso, podrías ver los mensajes de ambos botones. Pero solo se muestra el mensaje del último botón. El mensaje del primer botón se pierde.

Expand Down
4 changes: 4 additions & 0 deletions src/content/learn/removing-effect-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,11 @@ export default function Timer() {

</Sandpack>

<<<<<<< HEAD
En lugar de leer `count` dentro del Efecto, pasas a React una instrucción `c => c + 1` ("¡incrementa este número!"). React la aplicará en el próximo renderizado. Y dado que ya no tienes que leer el valor de `count` dentro de tu Efecto, puedes mantener vacío (`[]`) el *array* de dependencias de tu Efecto. Así se evita que tu Efecto recree el intervalo en cada tic.
=======
Instead of reading `count` inside the Effect, you pass a `c => c + 1` instruction ("increment this number!") to React. React will apply it on the next render. And since you don't need to read the value of `count` inside your Effect anymore, you can keep your Effect's dependencies empty (`[]`). This prevents your Effect from re-creating the interval on every tick.
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91

</Solution>

Expand Down
5 changes: 4 additions & 1 deletion src/content/learn/reusing-logic-with-custom-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,11 @@ export default function ChatRoom({ roomId }) {
// ...
```

<<<<<<< HEAD
y lo pasas como entrada a otro Hook:
=======
and passing it as an input to another Hook:
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91

```js {6}
export default function ChatRoom({ roomId }) {
Expand Down Expand Up @@ -2081,7 +2085,6 @@ Escribe `useInterval` en el archivo `useInterval.js` e impórtalo en el archivo
<Sandpack>

```js
import { useState } from 'react';
import { useCounter } from './useCounter.js';

export default function Counter() {
Expand Down
Loading
Loading