Skip to content

Commit f6f5950

Browse files
merging all conflicts
2 parents d808615 + d34c6a2 commit f6f5950

20 files changed

+246
-144
lines changed
16.3 KB
Loading

src/components/DocsFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function FooterLink({
8080
/>
8181
<div className="flex flex-col overflow-hidden">
8282
<span className="text-sm font-bold tracking-wide no-underline uppercase text-secondary dark:text-secondary-dark group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">
83-
{type}
83+
{type === 'Previous' ? 'Previous' : 'Next'}
8484
</span>
8585
<span className="text-lg break-words group-hover:underline">
8686
{title}

src/components/Icon/IconArrowSmall.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const IconArrowSmall = memo<
1919
const classes = cn(className, {
2020
'rotate-180': displayDirection === 'left',
2121
'rotate-180 rtl:rotate-0': displayDirection === 'start',
22+
'rtl:rotate-180': displayDirection === 'end',
2223
'rotate-90': displayDirection === 'down',
2324
});
2425
return (

src/components/MDX/Challenges/Navigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function Navigation({
108108
onClick={handleScrollLeft}
109109
aria-label="Scroll left"
110110
className={cn(
111-
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-l border-gray-20 border-r rtl:rotate-180',
111+
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-l rtl:rounded-r rtl:rounded-l-none border-gray-20 border-r rtl:border-l rtl:border-r-0',
112112
{
113113
'text-primary dark:text-primary-dark': canScrollLeft,
114114
'text-gray-30': !canScrollLeft,
@@ -120,7 +120,7 @@ export function Navigation({
120120
onClick={handleScrollRight}
121121
aria-label="Scroll right"
122122
className={cn(
123-
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-e rtl:rotate-180',
123+
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-e',
124124
{
125125
'text-primary dark:text-primary-dark': canScrollRight,
126126
'text-gray-30': !canScrollRight,

src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2521,7 +2521,7 @@ export default function App() {
25212521
const { url } = useRouter();
25222522

25232523
// Define a default animation of .slow-fade.
2524-
// See animations.css for the animation definiton.
2524+
// See animations.css for the animation definition.
25252525
return (
25262526
<ViewTransition default="slow-fade">
25272527
{url === '/' ? <Home /> : <Details />}

src/content/community/conferences.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ October 2-4, 2025. Alicante, Spain.
2020

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

23+
### RenderCon Kenya 2025 {/*rendercon-kenya-2025*/}
24+
October 04, 2025. Nairobi, Kenya
25+
26+
[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)
27+
2328
### React Conf 2025 {/*react-conf-2025*/}
2429
October 7-8, 2025. Henderson, Nevada, USA and free livestream
2530

src/content/community/meetups.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
5858
* [Manchester](https://www.meetup.com/Manchester-React-User-Group/)
5959
* [React.JS Girls London](https://www.meetup.com/ReactJS-Girls-London/)
6060
* [React Advanced London](https://guild.host/react-advanced-london)
61+
* [React Native Liverpool](https://www.meetup.com/react-native-liverpool/)
6162
* [React Native London](https://guild.host/RNLDN)
6263

6364
## Finland {/*finland*/}
@@ -137,6 +138,9 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
137138
## Portugal {/*portugal*/}
138139
* [Lisbon](https://www.meetup.com/JavaScript-Lisbon/)
139140

141+
## Scotland (UK) {/*scotland-uk*/}
142+
* [Edinburgh](https://www.meetup.com/react-edinburgh/)
143+
140144
## Spain {/*spain*/}
141145
* [Barcelona](https://www.meetup.com/ReactJS-Barcelona/)
142146

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ For code-splitting instructions, see your build tool docs:
122122

123123
### Improving Application Performance {/*improving-application-performance*/}
124124

125-
Since the build tool you select only support single page apps (SPAs) you'll need to implement other [rendering patterns](https://www.patterns.dev/vanilla/rendering-patterns) like server-side rendering (SSR), static site generation (SSG), and/or React Server Components (RSC). Even if you don't need these features at first, in the future there may be some routes that would benefit SSR, SSG or RSC.
125+
Since the build tool you select only supports single page apps (SPAs), you'll need to implement other [rendering patterns](https://www.patterns.dev/vanilla/rendering-patterns) like server-side rendering (SSR), static site generation (SSG), and/or React Server Components (RSC). Even if you don't need these features at first, in the future there may be some routes that would benefit SSR, SSG or RSC.
126126

127127
* **Single-page apps (SPA)** load a single HTML page and dynamically updates the page as the user interacts with the app. SPAs are easier to get started with, but they can have slower initial load times. SPAs are the default architecture for most build tools.
128128

src/content/learn/manipulating-the-dom-with-refs.md

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ li {
211211

212212
इस समस्या को हल करने का एक तरीका यह है कि उनके पैरेंट एलिमेंट के लिए एक रिफ लें और फिर DOM मैनिपुलेशन विधियों जैसे [`querySelectorAll`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) का उपयोग करके व्यक्तिगत चाइल्ड नोड्स "खोजें"। लेकिन यह तरीका नाजुक है और आपके DOM स्ट्रक्चर के बदलने पर टूट सकता है।
213213

214+
<<<<<<< HEAD
214215
एक और समाधान है कि **`ref` एट्रिब्यूट को एक फ़ंक्शन पास करें।** इसे [`ref` कॉलबैक](/reference/react-dom/components/common#ref-callback) कहा जाता है। React आपके रिफ कॉलबैक को DOM नोड के साथ तब कॉल करेगा जब रिफ सेट करना हो, और `null` के साथ जब रिफ को क्लियर करना हो। यह आपको अपनी खुद की [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) या ऐरे बनाए रखने देता है और किसी रिफ तक इसकी इंडेक्स या किसी प्रकार के ID के माध्यम से पहुंचने देता है।
216+
=======
217+
Another solution is to **pass a function to the `ref` attribute.** This is called a [`ref` callback.](/reference/react-dom/components/common#ref-callback) React will call your ref callback with the DOM node when it's time to set the ref, and call the cleanup function returned from the callback when it's time to clear it. This lets you maintain your own array or a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), and access any ref by its index or some kind of ID.
218+
>>>>>>> d34c6a2c6fa49fc6f64b07aa4fa979d86d41c4e8
215219
216220
यह उदाहरण दिखाता है कि आप इस तरीके का उपयोग करके किसी लंबी लिस्ट में किसी भी नोड को स्क्रॉल कैसे कर सकते हैं:
217221

@@ -247,13 +251,13 @@ export default function CatFriends() {
247251
<nav>
248252
<button onClick={() => scrollToCat(catList[0])}>Neo</button>
249253
<button onClick={() => scrollToCat(catList[5])}>Millie</button>
250-
<button onClick={() => scrollToCat(catList[9])}>Bella</button>
254+
<button onClick={() => scrollToCat(catList[8])}>Bella</button>
251255
</nav>
252256
<div>
253257
<ul>
254258
{catList.map((cat) => (
255259
<li
256-
key={cat}
260+
key={cat.id}
257261
ref={(node) => {
258262
const map = getMap();
259263
map.set(cat, node);
@@ -263,7 +267,7 @@ export default function CatFriends() {
263267
};
264268
}}
265269
>
266-
<img src={cat} />
270+
<img src={cat.imageUrl} />
267271
</li>
268272
))}
269273
</ul>
@@ -273,11 +277,22 @@ export default function CatFriends() {
273277
}
274278

275279
function setupCatList() {
276-
const catList = [];
277-
for (let i = 0; i < 10; i++) {
278-
catList.push("https://loremflickr.com/320/240/cat?lock=" + i);
280+
const catCount = 10;
281+
const catList = new Array(catCount)
282+
for (let i = 0; i < catCount; i++) {
283+
let imageUrl = '';
284+
if (i < 5) {
285+
imageUrl = "https://placecats.com/neo/320/240";
286+
} else if (i < 8) {
287+
imageUrl = "https://placecats.com/millie/320/240";
288+
} else {
289+
imageUrl = "https://placecats.com/bella/320/240";
290+
}
291+
catList[i] = {
292+
id: i,
293+
imageUrl,
294+
};
279295
}
280-
281296
return catList;
282297
}
283298

@@ -878,12 +893,30 @@ export default function CatFriends() {
878893
);
879894
}
880895

881-
const catList = [];
882-
for (let i = 0; i < 10; i++) {
883-
catList.push({
896+
const catCount = 10;
897+
const catList = new Array(catCount);
898+
for (let i = 0; i < catCount; i++) {
899+
const bucket = Math.floor(Math.random() * catCount) % 2;
900+
let imageUrl = '';
901+
switch (bucket) {
902+
case 0: {
903+
imageUrl = "https://placecats.com/neo/250/200";
904+
break;
905+
}
906+
case 1: {
907+
imageUrl = "https://placecats.com/millie/250/200";
908+
break;
909+
}
910+
case 2:
911+
default: {
912+
imageUrl = "https://placecats.com/bella/250/200";
913+
break;
914+
}
915+
}
916+
catList[i] = {
884917
id: i,
885-
imageUrl: 'https://loremflickr.com/250/200/cat?lock=' + i
886-
});
918+
imageUrl,
919+
};
887920
}
888921

889922
```
@@ -962,7 +995,7 @@ export default function CatFriends() {
962995
behavior: 'smooth',
963996
block: 'nearest',
964997
inline: 'center'
965-
});
998+
});
966999
}}>
9671000
Next
9681001
</button>
@@ -994,12 +1027,30 @@ export default function CatFriends() {
9941027
);
9951028
}
9961029

997-
const catList = [];
998-
for (let i = 0; i < 10; i++) {
999-
catList.push({
1030+
const catCount = 10;
1031+
const catList = new Array(catCount);
1032+
for (let i = 0; i < catCount; i++) {
1033+
const bucket = Math.floor(Math.random() * catCount) % 2;
1034+
let imageUrl = '';
1035+
switch (bucket) {
1036+
case 0: {
1037+
imageUrl = "https://placecats.com/neo/250/200";
1038+
break;
1039+
}
1040+
case 1: {
1041+
imageUrl = "https://placecats.com/millie/250/200";
1042+
break;
1043+
}
1044+
case 2:
1045+
default: {
1046+
imageUrl = "https://placecats.com/bella/250/200";
1047+
break;
1048+
}
1049+
}
1050+
catList[i] = {
10001051
id: i,
1001-
imageUrl: 'https://loremflickr.com/250/200/cat?lock=' + i
1002-
});
1052+
imageUrl,
1053+
};
10031054
}
10041055

10051056
```

src/content/learn/react-compiler/introduction.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ const ExpensiveComponent = memo(function ExpensiveComponent({ data, onClick }) {
5050
});
5151
```
5252

53+
54+
<Note>
55+
56+
This manual memoization has a subtle bug that breaks memoization:
57+
58+
```js [[2, 1, "() => handleClick(item)"]]
59+
<Item key={item.id} onClick={() => handleClick(item)} />
60+
```
61+
62+
Even though `handleClick` is wrapped in `useCallback`, the arrow function `() => handleClick(item)` creates a new function every time the component renders. This means that `Item` will always receive a new `onClick` prop, breaking memoization.
63+
64+
React Compiler is able to optimize this correctly with or without the arrow function, ensuring that `Item` only re-renders when `props.onClick` changes.
65+
66+
</Note>
67+
5368
### After React Compiler {/*after-react-compiler*/}
5469

5570
With React Compiler, you write the same code without manual memoization:
@@ -74,7 +89,7 @@ function ExpensiveComponent({ data, onClick }) {
7489

7590
_[See this example in the React Compiler Playground](https://playground.react.dev/#N4Igzg9grgTgxgUxALhAMygOzgFwJYSYAEAogB4AOCmYeAbggMIQC2Fh1OAFMEQCYBDHAIA0RQowA2eOAGsiAXwCURYAB1iROITA4iFGBERgwCPgBEhAogF4iCStVoMACoeO1MAcy6DhSgG4NDSItHT0ACwFMPkkmaTlbIi48HAQWFRsAPlUQ0PFMKRlZFLSWADo8PkC8hSDMPJgEHFhiLjzQgB4+eiyO-OADIwQTM0thcpYBClL02xz2zXz8zoBJMqJZBABPG2BU9Mq+BQKiuT2uTJyomLizkoOMk4B6PqX8pSUFfs7nnro3qEapgFCAFEA)_
7691

77-
React Compiler automatically applies the equivalent optimizations, ensuring your app only re-renders when necessary.
92+
React Compiler automatically applies the optimal memoization, ensuring your app only re-renders when necessary.
7893

7994
<DeepDive>
8095
#### What kind of memoization does React Compiler add? {/*what-kind-of-memoization-does-react-compiler-add*/}

0 commit comments

Comments
 (0)