Skip to content

Commit 1e532ad

Browse files
merging all conflicts
2 parents 7fa3d31 + e9a7cb1 commit 1e532ad

19 files changed

+1019
-655
lines changed

scripts/deadLinkChecker.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ const anchorMap = new Map(); // Map<filepath, Set<anchorId>>
1212
const contributorMap = new Map(); // Map<anchorId, URL>
1313
<<<<<<< HEAD
1414
<<<<<<< HEAD
15+
<<<<<<< HEAD
1516
=======
1617
const redirectMap = new Map(); // Map<source, destination>
1718
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
1819
=======
1920
const redirectMap = new Map(); // Map<source, destination>
2021
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
22+
=======
23+
const redirectMap = new Map(); // Map<source, destination>
24+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
2125
let errorCodes = new Set();
2226

2327
async function readFileWithCache(filePath) {
@@ -170,11 +174,14 @@ async function validateLink(link) {
170174
return {valid: true};
171175
}
172176

177+
<<<<<<< HEAD
173178
<<<<<<< HEAD
174179
<<<<<<< HEAD
175180
=======
176181
=======
177182
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
183+
=======
184+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
178185
// Check for redirects
179186
if (redirectMap.has(urlWithoutAnchor)) {
180187
const redirectDestination = redirectMap.get(urlWithoutAnchor);
@@ -191,10 +198,13 @@ async function validateLink(link) {
191198
return validateLink(redirectedLink);
192199
}
193200

201+
<<<<<<< HEAD
194202
<<<<<<< HEAD
195203
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
196204
=======
197205
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
206+
=======
207+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
198208
// Check if it's an error code link
199209
const errorCodeMatch = urlWithoutAnchor.match(/^\/errors\/(\d+)$/);
200210
if (errorCodeMatch) {
@@ -329,6 +339,7 @@ async function fetchErrorCodes() {
329339
const codes = await response.json();
330340
errorCodes = new Set(Object.keys(codes));
331341
<<<<<<< HEAD
342+
<<<<<<< HEAD
332343
<<<<<<< HEAD
333344
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes\n`));
334345
=======
@@ -337,16 +348,22 @@ async function fetchErrorCodes() {
337348
=======
338349
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`));
339350
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
351+
=======
352+
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`));
353+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
340354
} catch (error) {
341355
throw new Error(`Failed to fetch error codes: ${error.message}`);
342356
}
343357
}
344358

359+
<<<<<<< HEAD
345360
<<<<<<< HEAD
346361
<<<<<<< HEAD
347362
=======
348363
=======
349364
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
365+
=======
366+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
350367
async function buildRedirectsMap() {
351368
try {
352369
const vercelConfigPath = path.join(__dirname, '../vercel.json');
@@ -371,23 +388,30 @@ async function buildRedirectsMap() {
371388
}
372389
}
373390

391+
<<<<<<< HEAD
374392
<<<<<<< HEAD
375393
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
376394
=======
377395
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
396+
=======
397+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
378398
async function main() {
379399
const files = getMarkdownFiles();
380400
console.log(chalk.gray(`Checking ${files.length} markdown files...`));
381401

382402
await fetchErrorCodes();
383403
<<<<<<< HEAD
384404
<<<<<<< HEAD
405+
<<<<<<< HEAD
385406
=======
386407
await buildRedirectsMap();
387408
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
388409
=======
389410
await buildRedirectsMap();
390411
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
412+
=======
413+
await buildRedirectsMap();
414+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
391415
await buildContributorMap();
392416
await buildAnchorMap(files);
393417

@@ -399,12 +423,16 @@ async function main() {
399423
if (deadLinks.length > 0) {
400424
<<<<<<< HEAD
401425
<<<<<<< HEAD
426+
<<<<<<< HEAD
402427
=======
403428
console.log('\n');
404429
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
405430
=======
406431
console.log('\n');
407432
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
433+
=======
434+
console.log('\n');
435+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
408436
for (const link of deadLinks) {
409437
console.log(chalk.yellow(`${link.file}:${link.line}:${link.column}`));
410438
console.log(chalk.reset(` Link text: ${link.text}`));

src/components/Layout/HomeContent.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,7 @@ function CommunityGallery() {
765765
}, []);
766766

767767
return (
768-
<div
769-
ref={ref}
770-
className="relative flex overflow-x-hidden overflow-y-visible w-auto">
768+
<div ref={ref} className="relative flex overflow-x-clip w-auto">
771769
<div
772770
className="w-full py-12 lg:py-20 whitespace-nowrap flex flex-row animate-marquee lg:animate-large-marquee"
773771
style={{
@@ -794,21 +792,26 @@ const CommunityImages = memo(function CommunityImages({isLazy}) {
794792
<div
795793
key={i}
796794
className={cn(
797-
`group flex justify-center px-5 min-w-[50%] lg:min-w-[25%] rounded-2xl relative`
795+
`group flex justify-center px-5 min-w-[50%] lg:min-w-[25%] rounded-2xl`
798796
)}>
799797
<div
800798
className={cn(
801-
'h-auto relative rounded-2xl overflow-hidden before:-skew-x-12 before:absolute before:inset-0 before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-all ease-in-out duration-300',
799+
'h-auto rounded-2xl before:rounded-2xl before:absolute before:pointer-events-none before:inset-0 before:transition-opacity before:-z-1 before:shadow-lg lg:before:shadow-2xl before:opacity-0 before:group-hover:opacity-100 transition-transform ease-in-out duration-300',
802800
i % 2 === 0
803-
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl'
804-
: 'group-hover:rotate-1 group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl rotate-[-2deg]'
801+
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110'
802+
: 'group-hover:rotate-1 group-hover:scale-110 rotate-[-2deg]'
805803
)}>
806-
<img
807-
loading={isLazy ? 'lazy' : 'eager'}
808-
src={src}
809-
alt={alt}
810-
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
811-
/>
804+
<div
805+
className={cn(
806+
'overflow-clip relative before:absolute before:inset-0 before:pointer-events-none before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-transform ease-in-out duration-300'
807+
)}>
808+
<img
809+
loading={isLazy ? 'lazy' : 'eager'}
810+
src={src}
811+
alt={alt}
812+
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
813+
/>
814+
</div>
812815
</div>
813816
</div>
814817
))}

src/content/learn/add-react-to-an-existing-project.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Here's how we recommend to set it up:
2424
2. **Specify `/some-app` as the *base path*** in your framework's configuration (here's how: [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath), [Gatsby](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/)).
2525
3. **Configure your server or a proxy** so that all requests under `/some-app/` are handled by your React app.
2626

27+
<<<<<<< HEAD
2728
<<<<<<< HEAD
2829
<<<<<<< HEAD
2930
This ensures the React part of your app can [benefit from the best practices](/learn/creating-a-react-app#full-stack-frameworks) baked into those frameworks.
@@ -33,6 +34,9 @@ This ensures the React part of your app can [benefit from the best practices](/l
3334
=======
3435
This ensures the React part of your app can [benefit from the best practices](/learn/build-a-react-app-from-scratch#consider-using-a-framework) baked into those frameworks.
3536
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
37+
=======
38+
This ensures the React part of your app can [benefit from the best practices](/learn/build-a-react-app-from-scratch#consider-using-a-framework) baked into those frameworks.
39+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
3640
3741
Many React-based frameworks are full-stack and let your React app take advantage of the server. However, you can use the same approach even if you can't or don't want to run JavaScript on the server. In that case, serve the HTML/CSS/JS export ([`next export` output](https://nextjs.org/docs/advanced-features/static-html-export) for Next.js, default for Gatsby) at `/some-app/` instead.
3842

src/content/learn/synchronizing-with-effects.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ Writing `fetch` calls inside Effects is a [popular way to fetch data](https://ww
732732
733733
This list of downsides is not specific to React. It applies to fetching data on mount with any library. Like with routing, data fetching is not trivial to do well, so we recommend the following approaches:
734734
735+
<<<<<<< HEAD
735736
<<<<<<< HEAD
736737
<<<<<<< HEAD
737738
- **If you use a [framework](/learn/creating-a-react-app#full-stack-frameworks), use its built-in data fetching mechanism.** Modern React frameworks have integrated data fetching mechanisms that are efficient and don't suffer from the above pitfalls.
@@ -741,6 +742,9 @@ This list of downsides is not specific to React. It applies to fetching data on
741742
=======
742743
- **If you use a [framework](/learn/start-a-new-react-project#full-stack-frameworks), use its built-in data fetching mechanism.** Modern React frameworks have integrated data fetching mechanisms that are efficient and don't suffer from the above pitfalls.
743744
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
745+
=======
746+
- **If you use a [framework](/learn/start-a-new-react-project#full-stack-frameworks), use its built-in data fetching mechanism.** Modern React frameworks have integrated data fetching mechanisms that are efficient and don't suffer from the above pitfalls.
747+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
744748
- **Otherwise, consider using or building a client-side cache.** Popular open source solutions include [React Query](https://tanstack.com/query/latest), [useSWR](https://swr.vercel.app/), and [React Router 6.4+.](https://beta.reactrouter.com/en/main/start/overview) You can build your own solution too, in which case you would use Effects under the hood, but add logic for deduplicating requests, caching responses, and avoiding network waterfalls (by preloading data or hoisting data requirements to routes).
745749
746750
You can continue fetching data directly in Effects if neither of these approaches suit you.

src/content/learn/typescript.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ TypeScript is a popular way to add type definitions to JavaScript codebases. Out
2020

2121
## Installation {/*installation*/}
2222

23+
<<<<<<< HEAD
2324
<<<<<<< HEAD
2425
<<<<<<< HEAD
2526
All [production-grade React frameworks](/learn/creating-a-react-app#full-stack-frameworks) offer support for using TypeScript. Follow the framework specific guide for installation:
@@ -29,6 +30,9 @@ All [production-grade React frameworks](/learn/start-a-new-react-project#full-st
2930
=======
3031
All [production-grade React frameworks](/learn/start-a-new-react-project#full-stack-frameworks) offer support for using TypeScript. Follow the framework specific guide for installation:
3132
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
33+
=======
34+
All [production-grade React frameworks](/learn/start-a-new-react-project#full-stack-frameworks) offer support for using TypeScript. Follow the framework specific guide for installation:
35+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
3236
3337
- [Next.js](https://nextjs.org/docs/app/building-your-application/configuring/typescript)
3438
- [Remix](https://remix.run/docs/en/1.19.2/guides/typescript)

src/content/learn/you-might-not-need-an-effect.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ There are two common cases in which you don't need Effects:
2626
* **You don't need Effects to transform data for rendering.** For example, let's say you want to filter a list before displaying it. You might feel tempted to write an Effect that updates a state variable when the list changes. However, this is inefficient. When you update the state, React will first call your component functions to calculate what should be on the screen. Then React will ["commit"](/learn/render-and-commit) these changes to the DOM, updating the screen. Then React will run your Effects. If your Effect *also* immediately updates the state, this restarts the whole process from scratch! To avoid the unnecessary render passes, transform all the data at the top level of your components. That code will automatically re-run whenever your props or state change.
2727
* **You don't need Effects to handle user events.** For example, let's say you want to send an `/api/buy` POST request and show a notification when the user buys a product. In the Buy button click event handler, you know exactly what happened. By the time an Effect runs, you don't know *what* the user did (for example, which button was clicked). This is why you'll usually handle user events in the corresponding event handlers.
2828

29+
<<<<<<< HEAD
2930
<<<<<<< HEAD
3031
<<<<<<< HEAD
3132
You *do* need Effects to [synchronize](/learn/synchronizing-with-effects#what-are-effects-and-how-are-they-different-from-events) with external systems. For example, you can write an Effect that keeps a jQuery widget synchronized with the React state. You can also fetch data with Effects: for example, you can synchronize the search results with the current search query. Keep in mind that modern [frameworks](/learn/creating-a-react-app#full-stack-frameworks) provide more efficient built-in data fetching mechanisms than writing Effects directly in your components.
@@ -35,6 +36,9 @@ You *do* need Effects to [synchronize](/learn/synchronizing-with-effects#what-ar
3536
=======
3637
You *do* need Effects to [synchronize](/learn/synchronizing-with-effects#what-are-effects-and-how-are-they-different-from-events) with external systems. For example, you can write an Effect that keeps a jQuery widget synchronized with the React state. You can also fetch data with Effects: for example, you can synchronize the search results with the current search query. Keep in mind that modern [frameworks](/learn/start-a-new-react-project#full-stack-frameworks) provide more efficient built-in data fetching mechanisms than writing Effects directly in your components.
3738
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
39+
=======
40+
You *do* need Effects to [synchronize](/learn/synchronizing-with-effects#what-are-effects-and-how-are-they-different-from-events) with external systems. For example, you can write an Effect that keeps a jQuery widget synchronized with the React state. You can also fetch data with Effects: for example, you can synchronize the search results with the current search query. Keep in mind that modern [frameworks](/learn/start-a-new-react-project#full-stack-frameworks) provide more efficient built-in data fetching mechanisms than writing Effects directly in your components.
41+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
3842
3943
To help you gain the right intuition, let's look at some common concrete examples!
4044

@@ -765,6 +769,7 @@ This ensures that when your Effect fetches data, all responses except the last r
765769
766770
Handling race conditions is not the only difficulty with implementing data fetching. You might also want to think about caching responses (so that the user can click Back and see the previous screen instantly), how to fetch data on the server (so that the initial server-rendered HTML contains the fetched content instead of a spinner), and how to avoid network waterfalls (so that a child can fetch data without waiting for every parent).
767771
772+
<<<<<<< HEAD
768773
<<<<<<< HEAD
769774
<<<<<<< HEAD
770775
**These issues apply to any UI library, not just React. Solving them is not trivial, which is why modern [frameworks](/learn/creating-a-react-app#full-stack-frameworks) provide more efficient built-in data fetching mechanisms than fetching data in Effects.**
@@ -774,6 +779,9 @@ Handling race conditions is not the only difficulty with implementing data fetch
774779
=======
775780
**These issues apply to any UI library, not just React. Solving them is not trivial, which is why modern [frameworks](/learn/start-a-new-react-project#full-stack-frameworks) provide more efficient built-in data fetching mechanisms than fetching data in Effects.**
776781
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
782+
=======
783+
**These issues apply to any UI library, not just React. Solving them is not trivial, which is why modern [frameworks](/learn/start-a-new-react-project#full-stack-frameworks) provide more efficient built-in data fetching mechanisms than fetching data in Effects.**
784+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
777785
778786
If you don't use a framework (and don't want to build your own) but would like to make data fetching from Effects more ergonomic, consider extracting your fetching logic into a custom Hook like in this example:
779787

src/content/reference/react-dom/client/createRoot.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ When your HTML is empty, the user sees a blank page until the app's JavaScript c
209209
<div id="root"></div>
210210
```
211211
212+
<<<<<<< HEAD
212213
<<<<<<< HEAD
213214
<<<<<<< HEAD
214215
This can feel very slow! To solve this, you can generate the initial HTML from your components [on the server or during the build.](/reference/react-dom/server) Then your visitors can read text, see images, and click links before any of the JavaScript code loads. We recommend [using a framework](/learn/creating-a-react-app#full-stack-frameworks) that does this optimization out of the box. Depending on when it runs, this is called *server-side rendering (SSR)* or *static site generation (SSG).*
@@ -218,6 +219,9 @@ This can feel very slow! To solve this, you can generate the initial HTML from y
218219
=======
219220
This can feel very slow! To solve this, you can generate the initial HTML from your components [on the server or during the build.](/reference/react-dom/server) Then your visitors can read text, see images, and click links before any of the JavaScript code loads. We recommend [using a framework](/learn/start-a-new-react-project#full-stack-frameworks) that does this optimization out of the box. Depending on when it runs, this is called *server-side rendering (SSR)* or *static site generation (SSG).*
220221
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
222+
=======
223+
This can feel very slow! To solve this, you can generate the initial HTML from your components [on the server or during the build.](/reference/react-dom/server) Then your visitors can read text, see images, and click links before any of the JavaScript code loads. We recommend [using a framework](/learn/start-a-new-react-project#full-stack-frameworks) that does this optimization out of the box. Depending on when it runs, this is called *server-side rendering (SSR)* or *static site generation (SSG).*
224+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
221225
222226
</Note>
223227

src/content/reference/react-dom/client/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Client React DOM APIs
44

55
<Intro>
66

7+
<<<<<<< HEAD
78
<<<<<<< HEAD
89
<<<<<<< HEAD
910
The `react-dom/client` APIs let you render React components on the client (in the browser). These APIs are typically used at the top level of your app to initialize your React tree. A [framework](/learn/creating-a-react-app#full-stack-frameworks) may call them for you. Most of your components don't need to import or use them.
@@ -13,6 +14,9 @@ The `react-dom/client` APIs let you render React components on the client (in th
1314
=======
1415
The `react-dom/client` APIs let you render React components on the client (in the browser). These APIs are typically used at the top level of your app to initialize your React tree. A [framework](/learn/start-a-new-react-project#full-stack-frameworks) may call them for you. Most of your components don't need to import or use them.
1516
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
17+
=======
18+
The `react-dom/client` APIs let you render React components on the client (in the browser). These APIs are typically used at the top level of your app to initialize your React tree. A [framework](/learn/start-a-new-react-project#full-stack-frameworks) may call them for you. Most of your components don't need to import or use them.
19+
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
1620
1721
</Intro>
1822

0 commit comments

Comments
 (0)