Skip to content

Commit 748e194

Browse files
fix: remove leftover merge conflict markers (#483)
Co-authored-by: Mohammad Reza Badri <[email protected]>
1 parent 97833d0 commit 748e194

18 files changed

+70
-466
lines changed

scripts/deadLinkChecker.js

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,7 @@ const PUBLIC_DIR = path.join(__dirname, '../public');
1010
const fileCache = new Map();
1111
const anchorMap = new Map(); // Map<filepath, Set<anchorId>>
1212
const contributorMap = new Map(); // Map<anchorId, URL>
13-
<<<<<<< HEAD
14-
<<<<<<< HEAD
15-
<<<<<<< HEAD
16-
=======
1713
const redirectMap = new Map(); // Map<source, destination>
18-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
19-
=======
20-
const redirectMap = new Map(); // Map<source, destination>
21-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
22-
=======
23-
const redirectMap = new Map(); // Map<source, destination>
24-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
2514
let errorCodes = new Set();
2615

2716
async function readFileWithCache(filePath) {
@@ -174,14 +163,6 @@ async function validateLink(link) {
174163
return {valid: true};
175164
}
176165

177-
<<<<<<< HEAD
178-
<<<<<<< HEAD
179-
<<<<<<< HEAD
180-
=======
181-
=======
182-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
183-
=======
184-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
185166
// Check for redirects
186167
if (redirectMap.has(urlWithoutAnchor)) {
187168
const redirectDestination = redirectMap.get(urlWithoutAnchor);
@@ -198,13 +179,6 @@ async function validateLink(link) {
198179
return validateLink(redirectedLink);
199180
}
200181

201-
<<<<<<< HEAD
202-
<<<<<<< HEAD
203-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
204-
=======
205-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
206-
=======
207-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
208182
// Check if it's an error code link
209183
const errorCodeMatch = urlWithoutAnchor.match(/^\/errors\/(\d+)$/);
210184
if (errorCodeMatch) {
@@ -338,32 +312,12 @@ async function fetchErrorCodes() {
338312
}
339313
const codes = await response.json();
340314
errorCodes = new Set(Object.keys(codes));
341-
<<<<<<< HEAD
342-
<<<<<<< HEAD
343-
<<<<<<< HEAD
344-
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes\n`));
345-
=======
346-
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`));
347-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
348-
=======
349-
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`));
350-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
351-
=======
352315
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`));
353-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
354316
} catch (error) {
355317
throw new Error(`Failed to fetch error codes: ${error.message}`);
356318
}
357319
}
358320

359-
<<<<<<< HEAD
360-
<<<<<<< HEAD
361-
<<<<<<< HEAD
362-
=======
363-
=======
364-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
365-
=======
366-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
367321
async function buildRedirectsMap() {
368322
try {
369323
const vercelConfigPath = path.join(__dirname, '../vercel.json');
@@ -388,30 +342,12 @@ async function buildRedirectsMap() {
388342
}
389343
}
390344

391-
<<<<<<< HEAD
392-
<<<<<<< HEAD
393-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
394-
=======
395-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
396-
=======
397-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
398345
async function main() {
399346
const files = getMarkdownFiles();
400347
console.log(chalk.gray(`Checking ${files.length} markdown files...`));
401348

402349
await fetchErrorCodes();
403-
<<<<<<< HEAD
404-
<<<<<<< HEAD
405-
<<<<<<< HEAD
406-
=======
407350
await buildRedirectsMap();
408-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
409-
=======
410-
await buildRedirectsMap();
411-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
412-
=======
413-
await buildRedirectsMap();
414-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
415351
await buildContributorMap();
416352
await buildAnchorMap(files);
417353

@@ -421,18 +357,7 @@ async function main() {
421357
const totalLinks = results.reduce((sum, r) => sum + r.totalLinks, 0);
422358

423359
if (deadLinks.length > 0) {
424-
<<<<<<< HEAD
425-
<<<<<<< HEAD
426-
<<<<<<< HEAD
427-
=======
428-
console.log('\n');
429-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
430-
=======
431-
console.log('\n');
432-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
433-
=======
434360
console.log('\n');
435-
>>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983
436361
for (const link of deadLinks) {
437362
console.log(chalk.yellow(`${link.file}:${link.line}:${link.column}`));
438363
console.log(chalk.reset(` Link text: ${link.text}`));

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,11 @@ Let's say you have an existing web app at `example.com` built with another serve
2020

2121
Here's how we recommend to set it up:
2222

23-
1. **Build the React part of your app** using one of the [React-based frameworks](/learn/creating-a-react-app).
23+
1. **Build the React part of your app** using one of the [React-based frameworks](/learn/start-a-new-react-project).
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
28-
<<<<<<< HEAD
29-
<<<<<<< HEAD
30-
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.
31-
=======
3227
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.
33-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
34-
=======
35-
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.
36-
>>>>>>> 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
4028

4129
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.
4230

@@ -161,7 +149,7 @@ root.render(<NavigationBar />);
161149

162150
Notice how the original HTML content from `index.html` is preserved, but your own `NavigationBar` React component now appears inside the `<nav id="navigation">` from your HTML. Read the [`createRoot` usage documentation](/reference/react-dom/client/createRoot#rendering-a-page-partially-built-with-react) to learn more about rendering React components inside an existing HTML page.
163151

164-
When you adopt React in an existing project, it's common to start with small interactive components (like buttons), and then gradually keep "moving upwards" until eventually your entire page is built with React. If you ever reach that point, we recommend migrating to [a React framework](/learn/creating-a-react-app) right after to get the most out of React.
152+
When you adopt React in an existing project, it's common to start with small interactive components (like buttons), and then gradually keep "moving upwards" until eventually your entire page is built with React. If you ever reach that point, we recommend migrating to [a React framework](/learn/start-a-new-react-project) right after to get the most out of React.
165153

166154
## Using React Native in an existing native mobile app {/*using-react-native-in-an-existing-native-mobile-app*/}
167155

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -732,19 +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
736-
<<<<<<< HEAD
737-
<<<<<<< HEAD
738-
- **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.
739-
=======
740735
- **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.
741-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
742-
=======
743-
- **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.
744-
>>>>>>> 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
748736
- **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).
749737
750738
You can continue fetching data directly in Effects if neither of these approaches suit you.

src/content/learn/typescript.md

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

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

23-
<<<<<<< HEAD
24-
<<<<<<< HEAD
25-
<<<<<<< HEAD
26-
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:
27-
=======
2823
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:
29-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
30-
=======
31-
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:
32-
>>>>>>> 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
3624

3725
- [Next.js](https://nextjs.org/docs/app/building-your-application/configuring/typescript)
3826
- [Remix](https://remix.run/docs/en/1.19.2/guides/typescript)

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +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
30-
<<<<<<< HEAD
31-
<<<<<<< HEAD
32-
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.
33-
=======
3429
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.
35-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
36-
=======
37-
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.
38-
>>>>>>> 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
4230

4331
To help you gain the right intuition, let's look at some common concrete examples!
4432

@@ -769,19 +757,7 @@ This ensures that when your Effect fetches data, all responses except the last r
769757
770758
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).
771759
772-
<<<<<<< HEAD
773-
<<<<<<< HEAD
774-
<<<<<<< HEAD
775-
**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.**
776-
=======
777-
**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.**
778-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
779-
=======
780-
**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.**
781-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
782-
=======
783760
**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
785761
786762
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:
787763

0 commit comments

Comments
 (0)