Skip to content

Commit 4d03833

Browse files
merging all conflicts
2 parents 0757df2 + 2571aee commit 4d03833

22 files changed

+304
-17
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+
>>>>>>> 2571aee6dba2e9790172a70224dac8371640b772

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+
>>>>>>> 2571aee6dba2e9790172a70224dac8371640b772
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+
>>>>>>> 2571aee6dba2e9790172a70224dac8371640b772
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+
>>>>>>> 2571aee6dba2e9790172a70224dac8371640b772
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: 39 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+
>>>>>>> 2571aee6dba2e9790172a70224dac8371640b772
444450
445451
<Sandpack>
446452
@@ -972,6 +978,23 @@ Para arreglar este código, basta con seguir las reglas.
972978
973979
<Sandpack>
974980
981+
```json package.json hidden
982+
{
983+
"dependencies": {
984+
"react": "experimental",
985+
"react-dom": "experimental",
986+
"react-scripts": "latest"
987+
},
988+
"scripts": {
989+
"start": "react-scripts start",
990+
"build": "react-scripts build",
991+
"test": "react-scripts test --env=jsdom",
992+
"eject": "react-scripts eject"
993+
}
994+
}
995+
```
996+
997+
975998
```js
976999
import { useState, useEffect } from 'react';
9771000

@@ -1025,6 +1048,22 @@ Si eliminas el comentario de supresión, React te dirá que el código de este E
10251048
10261049
<Sandpack>
10271050
1051+
```json package.json hidden
1052+
{
1053+
"dependencies": {
1054+
"react": "experimental",
1055+
"react-dom": "experimental",
1056+
"react-scripts": "latest"
1057+
},
1058+
"scripts": {
1059+
"start": "react-scripts start",
1060+
"build": "react-scripts build",
1061+
"test": "react-scripts test --env=jsdom",
1062+
"eject": "react-scripts eject"
1063+
}
1064+
}
1065+
```
1066+
10281067
```js
10291068
import { useState, useEffect } from 'react';
10301069

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-dom/static/prerender.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
5757
* **optional** `namespaceURI`: A string with the root [namespace URI](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris) for the stream. Defaults to regular HTML. Pass `'http://www.w3.org/2000/svg'` for SVG or `'http://www.w3.org/1998/Math/MathML'` for MathML.
5858
* **optional** `onError`: A callback that fires whenever there is a server error, whether [recoverable](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-outside-the-shell) or [not.](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-inside-the-shell) By default, this only calls `console.error`. If you override it to [log crash reports,](/reference/react-dom/server/renderToReadableStream#logging-crashes-on-the-server) make sure that you still call `console.error`. You can also use it to [adjust the status code](/reference/react-dom/server/renderToReadableStream#setting-the-status-code) before the shell is emitted.
5959
* **optional** `progressiveChunkSize`: The number of bytes in a chunk. [Read more about the default heuristic.](https://github.com/facebook/react/blob/14c2be8dac2d5482fda8a0906a31d239df8551fc/packages/react-server/src/ReactFizzServer.js#L210-L225)
60-
* **optional** `signal`: An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that lets you [abort server rendering](/reference/react-dom/server/renderToReadableStream#aborting-server-rendering) and render the rest on the client.
60+
* **optional** `signal`: An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that lets you [abort prerendering](#aborting-prerendering) and render the rest on the client.
6161
6262
#### Returns {/*returns*/}
6363
@@ -66,7 +66,9 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
6666
- `prelude`: a [Web Stream](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) of HTML. You can use this stream to send a response in chunks, or you can read the entire stream into a string.
6767
- If rendering fails, the Promise will be rejected. [Use this to output a fallback shell.](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-inside-the-shell)
6868
69+
#### Caveats {/*caveats*/}
6970
71+
`nonce` is not an available option when prerendering. Nonces must be unique per request and if you use nonces to secure your application with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) it would be inappropriate and insecure to include the a nonce value in the prerender itself.
7072
7173
7274
<Note>
@@ -287,6 +289,30 @@ Suspense-enabled data fetching without the use of an opinionated framework is no
287289
288290
---
289291
292+
### Aborting prerendering {/*aborting-prerendering*/}
293+
294+
You can force the prerender to "give up" after a timeout:
295+
296+
```js {2-5,11}
297+
async function renderToString() {
298+
const controller = new AbortController();
299+
setTimeout(() => {
300+
controller.abort()
301+
}, 10000);
302+
303+
try {
304+
// the prelude will contain all the HTML that was prerendered
305+
// before the controller aborted.
306+
const {prelude} = await prerender(<App />, {
307+
signal: controller.signal,
308+
});
309+
//...
310+
```
311+
312+
Any Suspense boundaries with incomplete children will be included in the prelude in the fallback state.
313+
314+
---
315+
290316
## Troubleshooting {/*troubleshooting*/}
291317
292318
### My stream doesn't start until the entire app is rendered {/*my-stream-doesnt-start-until-the-entire-app-is-rendered*/}

src/content/reference/react-dom/static/prerenderToNodeStream.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
5858
* **optional** `namespaceURI`: A string with the root [namespace URI](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris) for the stream. Defaults to regular HTML. Pass `'http://www.w3.org/2000/svg'` for SVG or `'http://www.w3.org/1998/Math/MathML'` for MathML.
5959
* **optional** `onError`: A callback that fires whenever there is a server error, whether [recoverable](/reference/react-dom/server/renderToPipeableStream#recovering-from-errors-outside-the-shell) or [not.](/reference/react-dom/server/renderToPipeableStream#recovering-from-errors-inside-the-shell) By default, this only calls `console.error`. If you override it to [log crash reports,](/reference/react-dom/server/renderToPipeableStream#logging-crashes-on-the-server) make sure that you still call `console.error`. You can also use it to [adjust the status code](/reference/react-dom/server/renderToPipeableStream#setting-the-status-code) before the shell is emitted.
6060
* **optional** `progressiveChunkSize`: The number of bytes in a chunk. [Read more about the default heuristic.](https://github.com/facebook/react/blob/14c2be8dac2d5482fda8a0906a31d239df8551fc/packages/react-server/src/ReactFizzServer.js#L210-L225)
61-
* **optional** `signal`: An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that lets you [abort server rendering](/reference/react-dom/server/renderToPipeableStream#aborting-server-rendering) and render the rest on the client.
61+
* **optional** `signal`: An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that lets you [abort prerendering](#aborting-prerendering) and render the rest on the client.
6262
6363
#### Returns {/*returns*/}
6464
@@ -67,6 +67,10 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
6767
- `prelude`: a [Node.js Stream.](https://nodejs.org/api/stream.html) of HTML. You can use this stream to send a response in chunks, or you can read the entire stream into a string.
6868
- If rendering fails, the Promise will be rejected. [Use this to output a fallback shell.](/reference/react-dom/server/renderToPipeableStream#recovering-from-errors-inside-the-shell)
6969
70+
#### Caveats {/*caveats*/}
71+
72+
`nonce` is not an available option when prerendering. Nonces must be unique per request and if you use nonces to secure your application with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) it would be inappropriate and insecure to include the a nonce value in the prerender itself.
73+
7074
<Note>
7175
7276
### When should I use `prerenderToNodeStream`? {/*when-to-use-prerender*/}
@@ -285,6 +289,30 @@ Suspense-enabled data fetching without the use of an opinionated framework is no
285289
286290
---
287291
292+
### Aborting prerendering {/*aborting-prerendering*/}
293+
294+
You can force the prerender to "give up" after a timeout:
295+
296+
```js {2-5,11}
297+
async function renderToString() {
298+
const controller = new AbortController();
299+
setTimeout(() => {
300+
controller.abort()
301+
}, 10000);
302+
303+
try {
304+
// the prelude will contain all the HTML that was prerendered
305+
// before the controller aborted.
306+
const {prelude} = await prerenderToNodeStream(<App />, {
307+
signal: controller.signal,
308+
});
309+
//...
310+
```
311+
312+
Any Suspense boundaries with incomplete children will be included in the prelude in the fallback state.
313+
314+
---
315+
288316
## Troubleshooting {/*troubleshooting*/}
289317
290318
### My stream doesn't start until the entire app is rendered {/*my-stream-doesnt-start-until-the-entire-app-is-rendered*/}

0 commit comments

Comments
 (0)