Skip to content

Commit bea6fc6

Browse files
merging all conflicts
2 parents 0757df2 + 65d297e commit bea6fc6

20 files changed

+215
-15
lines changed
75.6 KB
Binary file not shown.
64.9 KB
Binary file not shown.
Binary file not shown.

src/components/Layout/HomeContent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ function ExampleLayout({
875875
</div>
876876
<div
877877
ref={contentRef}
878-
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center">
878+
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center"
879+
dir="ltr">
879880
{right}
880881
<div
881882
className={cn(

src/components/MDX/Sandpack/template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const template = {
22
'/src/index.js': {
33
hidden: true,
4-
code: `import React, { StrictMode } from "react";
4+
code: `import { StrictMode } from "react";
55
import { createRoot } from "react-dom/client";
66
import "./styles.css";
77

src/components/PageHeading.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function PageHeading({
2727
tags = [],
2828
breadcrumbs,
2929
}: PageHeadingProps) {
30-
console.log('version', version);
3130
return (
3231
<div className="px-5 sm:px-12 pt-3.5">
3332
<div className="max-w-4xl ms-0 2xl:mx-auto">

src/components/Seo.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ export const Seo = withRouter(
124124
)}
125125
<link
126126
rel="preload"
127-
href="/fonts/Source-Code-Pro-Regular.woff2"
127+
href="https://react.dev/fonts/Source-Code-Pro-Regular.woff2"
128+
as="font"
129+
type="font/woff2"
130+
crossOrigin="anonymous"
131+
/>
132+
<link
133+
rel="preload"
134+
href="https://react.dev/fonts/Source-Code-Pro-Bold.woff2"
128135
as="font"
129136
type="font/woff2"
130137
crossOrigin="anonymous"

src/content/community/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ Cada comunidad está constituida por miles de usuarios de React.
2929

3030
## Noticias {/*news*/}
3131

32+
<<<<<<< HEAD
3233
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.
34+
=======
35+
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.
36+
>>>>>>> 65d297e93b36be5370e58ab7828d022c741ecbe2

src/content/community/meetups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ title: Reuniones de React
3838

3939
## Canadá {/*canada*/}
4040
* [Halifax, NS](https://www.meetup.com/Halifax-ReactJS-Meetup/)
41-
* [Montreal, QC - React Native](https://www.meetup.com/fr-FR/React-Native-MTL/)
41+
* [Montreal, QC](https://guild.host/react-montreal/)
4242
* [Vancouver, BC](https://www.meetup.com/ReactJS-Vancouver-Meetup/)
4343
* [Ottawa, ON](https://www.meetup.com/Ottawa-ReactJS-Meetup/)
4444
* [Saskatoon, SK](https://www.meetup.com/saskatoon-react-meetup/)

src/content/learn/build-a-react-app-from-scratch.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,17 @@ De manera similar, si confías en que las aplicaciones usen tu framework para di
115115

116116
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)).
117117

118+
<<<<<<< HEAD
118119
Para obtener instrucciones sobre cómo dividir el código, consulte la documentación de su herramienta de compilación:
119120
- [Optimizaciones de compilación](https://es.vite.dev/guide/features.html#optimizaciones-de-compilacion)
120121
- [División de código con Parcel](https://parceljs.org/features/code-splitting/)
121122
- [División de código con Rsbuild](https://rsbuild.dev/guide/optimization/code-splitting)
123+
=======
124+
For code-splitting instructions, see your build tool docs:
125+
- [Vite build optimizations](https://vite.dev/guide/features.html#build-optimizations)
126+
- [Parcel code splitting](https://parceljs.org/features/code-splitting/)
127+
- [Rsbuild code splitting](https://rsbuild.dev/guide/optimization/code-splitting)
128+
>>>>>>> 65d297e93b36be5370e58ab7828d022c741ecbe2
122129
123130
### Mejorar el rendimiento de las aplicaciones {/*improving-application-performance*/}
124131

src/content/learn/preserving-and-resetting-state.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,7 @@ export default function ContactList() {
20112011
<label>
20122012
<input
20132013
type="checkbox"
2014-
value={reverse}
2014+
checked={reverse}
20152015
onChange={e => {
20162016
setReverse(e.target.checked)
20172017
}}
@@ -2110,7 +2110,7 @@ export default function ContactList() {
21102110
<label>
21112111
<input
21122112
type="checkbox"
2113-
value={reverse}
2113+
checked={reverse}
21142114
onChange={e => {
21152115
setReverse(e.target.checked)
21162116
}}

src/content/learn/removing-effect-dependencies.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,11 @@ export default function Timer() {
12391239
12401240
</Sandpack>
12411241
1242+
<<<<<<< HEAD
12421243
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.
1244+
=======
1245+
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.
1246+
>>>>>>> 65d297e93b36be5370e58ab7828d022c741ecbe2
12431247
12441248
</Solution>
12451249

src/content/learn/reusing-logic-with-custom-hooks.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,11 @@ export default function ChatRoom({ roomId }) {
820820
// ...
821821
```
822822
823+
<<<<<<< HEAD
823824
y lo pasas como entrada a otro Hook:
825+
=======
826+
and passing it as an input to another Hook:
827+
>>>>>>> 65d297e93b36be5370e58ab7828d022c741ecbe2
824828
825829
```js {6}
826830
export default function ChatRoom({ roomId }) {
@@ -2081,7 +2085,6 @@ Escribe `useInterval` en el archivo `useInterval.js` e impórtalo en el archivo
20812085
<Sandpack>
20822086
20832087
```js
2084-
import { useState } from 'react';
20852088
import { useCounter } from './useCounter.js';
20862089

20872090
export default function Counter() {

src/content/learn/separating-events-from-effects.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,14 @@ function ChatRoom({ roomId, theme }) {
439439
// ...
440440
```
441441
442+
<<<<<<< HEAD
442443
Esto resuelve el problema. Ten en cuenta que has tenido que *eliminar* `onConnected` de la lista de dependencias de tu Efecto. **Los Eventos de Efecto no son reactivos y deben ser omitidos de las dependencias.**
443444
Verifica que el nuevo comportamiento funciona como esperas:
445+
=======
446+
This solves the problem. Note that you had to *remove* `theme` from the list of your Effect's dependencies, because it's no longer used in the Effect. You also don't need to *add* `onConnected` to it, because **Effect Events are not reactive and must be omitted from dependencies.**
447+
448+
Verify that the new behavior works as you would expect:
449+
>>>>>>> 65d297e93b36be5370e58ab7828d022c741ecbe2
444450
445451
<Sandpack>
446452

src/content/reference/react-dom/preinit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The `preinit` function provides the browser with a hint that it should start dow
4848
* `options`: an object. It contains the following properties:
4949
* `as`: a required string. The type of resource. Its possible values are `script` and `style`.
5050
* `precedence`: a string. Required with stylesheets. Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. The possible values are `reset`, `low`, `medium`, `high`.
51-
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`. It is required when `as` is set to `"fetch"`.
51+
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
5252
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
5353
* `nonce`: a string. A cryptographic [nonce to allow the resource](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
5454
* `fetchPriority`: a string. Suggests a relative priority for fetching the resource. The possible values are `auto` (the default), `high`, and `low`.

src/content/reference/react/useTransition.md

Lines changed: 160 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function CheckoutForm() {
163163

164164
The function passed to `startTransition` is called the "Action". You can update state and (optionally) perform side effects within an Action, and the work will be done in the background without blocking user interactions on the page. A Transition can include multiple Actions, and while a Transition is in progress, your UI stays responsive. For example, if the user clicks a tab but then changes their mind and clicks another tab, the second click will be immediately handled without waiting for the first update to finish.
165165

166-
To give the user feedback about in-progress Transitions, to `isPending` state switches to `true` at the first call to `startTransition`, and stays `true` until all Actions complete and the final state is shown to the user. Transitions ensure side effects in Actions to complete in order to [prevent unwanted loading indicators](#preventing-unwanted-loading-indicators), and you can provide immediate feedback while the Transition is in progress with `useOptimistic`.
166+
To give the user feedback about in-progress Transitions, the `isPending` state switches to `true` at the first call to `startTransition`, and stays `true` until all Actions complete and the final state is shown to the user. Transitions ensure side effects in Actions to complete in order to [prevent unwanted loading indicators](#preventing-unwanted-loading-indicators), and you can provide immediate feedback while the Transition is in progress with `useOptimistic`.
167167

168168
<Recipes titleText="The difference between Actions and regular event handling">
169169

@@ -1948,3 +1948,162 @@ When clicking multiple times, it's possible for previous requests to finish afte
19481948
This is expected, because Actions within a Transition do not guarantee execution order. For common use cases, React provides higher-level abstractions like [`useActionState`](/reference/react/useActionState) and [`<form>` actions](/reference/react-dom/components/form) that handle ordering for you. For advanced use cases, you'll need to implement your own queuing and abort logic to handle this.
19491949
19501950
1951+
Example of `useActionState` handling execution order:
1952+
1953+
<Sandpack>
1954+
1955+
```json package.json hidden
1956+
{
1957+
"dependencies": {
1958+
"react": "beta",
1959+
"react-dom": "beta"
1960+
},
1961+
"scripts": {
1962+
"start": "react-scripts start",
1963+
"build": "react-scripts build",
1964+
"test": "react-scripts test --env=jsdom",
1965+
"eject": "react-scripts eject"
1966+
}
1967+
}
1968+
```
1969+
1970+
```js src/App.js
1971+
import { useState, useActionState } from "react";
1972+
import { updateQuantity } from "./api";
1973+
import Item from "./Item";
1974+
import Total from "./Total";
1975+
1976+
export default function App({}) {
1977+
// Store the actual quantity in separate state to show the mismatch.
1978+
const [clientQuantity, setClientQuantity] = useState(1);
1979+
const [quantity, updateQuantityAction, isPending] = useActionState(
1980+
async (prevState, payload) => {
1981+
setClientQuantity(payload);
1982+
const savedQuantity = await updateQuantity(payload);
1983+
return savedQuantity; // Return the new quantity to update the state
1984+
},
1985+
1 // Initial quantity
1986+
);
1987+
1988+
return (
1989+
<div>
1990+
<h1>Checkout</h1>
1991+
<Item action={updateQuantityAction}/>
1992+
<hr />
1993+
<Total clientQuantity={clientQuantity} savedQuantity={quantity} isPending={isPending} />
1994+
</div>
1995+
);
1996+
}
1997+
1998+
```
1999+
2000+
```js src/Item.js
2001+
import {startTransition} from 'react';
2002+
2003+
export default function Item({action}) {
2004+
function handleChange(e) {
2005+
// Update the quantity in an Action.
2006+
startTransition(() => {
2007+
action(e.target.value);
2008+
});
2009+
}
2010+
return (
2011+
<div className="item">
2012+
<span>Eras Tour Tickets</span>
2013+
<label htmlFor="name">Quantity: </label>
2014+
<input
2015+
type="number"
2016+
onChange={handleChange}
2017+
defaultValue={1}
2018+
min={1}
2019+
/>
2020+
</div>
2021+
)
2022+
}
2023+
```
2024+
2025+
```js src/Total.js
2026+
const intl = new Intl.NumberFormat("en-US", {
2027+
style: "currency",
2028+
currency: "USD"
2029+
});
2030+
2031+
export default function Total({ clientQuantity, savedQuantity, isPending }) {
2032+
return (
2033+
<div className="total">
2034+
<span>Total:</span>
2035+
<div>
2036+
<div>
2037+
{isPending
2038+
? "🌀 Updating..."
2039+
: `${intl.format(savedQuantity * 9999)}`}
2040+
</div>
2041+
<div className="error">
2042+
{!isPending &&
2043+
clientQuantity !== savedQuantity &&
2044+
`Wrong total, expected: ${intl.format(clientQuantity * 9999)}`}
2045+
</div>
2046+
</div>
2047+
</div>
2048+
);
2049+
}
2050+
```
2051+
2052+
```js src/api.js
2053+
let firstRequest = true;
2054+
export async function updateQuantity(newName) {
2055+
return new Promise((resolve, reject) => {
2056+
if (firstRequest === true) {
2057+
firstRequest = false;
2058+
setTimeout(() => {
2059+
firstRequest = true;
2060+
resolve(newName);
2061+
// Simulate every other request being slower
2062+
}, 1000);
2063+
} else {
2064+
setTimeout(() => {
2065+
resolve(newName);
2066+
}, 50);
2067+
}
2068+
});
2069+
}
2070+
```
2071+
2072+
```css
2073+
.item {
2074+
display: flex;
2075+
align-items: center;
2076+
justify-content: start;
2077+
}
2078+
2079+
.item label {
2080+
flex: 1;
2081+
text-align: right;
2082+
}
2083+
2084+
.item input {
2085+
margin-left: 4px;
2086+
width: 60px;
2087+
padding: 4px;
2088+
}
2089+
2090+
.total {
2091+
height: 50px;
2092+
line-height: 25px;
2093+
display: flex;
2094+
align-content: center;
2095+
justify-content: space-between;
2096+
}
2097+
2098+
.total div {
2099+
display: flex;
2100+
flex-direction: column;
2101+
align-items: flex-end;
2102+
}
2103+
2104+
.error {
2105+
color: red;
2106+
}
2107+
```
2108+
2109+
</Sandpack>

src/content/reference/rsc/server-functions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ Para soportar Server Functions como bundler o framework, recomendamos usar una v
2828

2929
</Note>
3030

31+
<<<<<<< HEAD
3132
Cuando se define una Server Function con la directiva [`"use server"`](/reference/rsc/use-server), tu framework creará automáticamente una referencia a la Server Function, y pasará esa referencia al Client Component. Cuando esa función es llamada en el cliente, React enviará una petición al servidor para ejecutar la función, y devolver el resultado.
33+
=======
34+
When a Server Function is defined with the [`"use server"`](/reference/rsc/use-server) directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.
35+
>>>>>>> 65d297e93b36be5370e58ab7828d022c741ecbe2
3236
3337
Las Server Functions pueden crearse en Server Components y pasarse como props a los Client Components, o pueden importarse y utilizarse en Client Components.
3438

src/content/warnings/react-dom-test-utils.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: react-dom/test-utils Deprecation Warnings
33
---
44

5-
TODO: update for 19?
6-
75
## ReactDOMTestUtils.act() warning {/*reactdomtestutilsact-warning*/}
86

97
`act` from `react-dom/test-utils` has been deprecated in favor of `act` from `react`.

src/content/warnings/react-test-renderer.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: react-test-renderer Deprecation Warnings
33
---
44

5-
TODO: Update this for 19?
6-
75
## ReactTestRenderer.create() warning {/*reacttestrenderercreate-warning*/}
86

97
react-test-renderer is deprecated. A warning will fire whenever calling ReactTestRenderer.create() or ReactShallowRender.render(). The react-test-renderer package will remain available on NPM but will not be maintained and may break with new React features or changes to React's internals.

src/styles/index.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
font-style: normal;
1313
font-weight: 400;
1414
font-display: swap;
15-
src: url('/fonts/Source-Code-Pro-Regular.woff2') format('woff2');
15+
src: url('https://react.dev/fonts/Source-Code-Pro-Regular.woff2')
16+
format('woff2');
17+
}
18+
19+
@font-face {
20+
font-family: 'Source Code Pro';
21+
font-style: normal;
22+
font-weight: 700;
23+
font-display: swap;
24+
src: url('https://react.dev/fonts/Source-Code-Pro-Bold.woff2')
25+
format('woff2');
1626
}
1727

1828
/* Latin */

0 commit comments

Comments
 (0)