Skip to content

Commit d303dce

Browse files
committed
Merge remote-tracking branch 'reactdev/main' into merge-react-dev
2 parents ec1441b + c019eb1 commit d303dce

10 files changed

Lines changed: 18 additions & 293 deletions

File tree

next.config.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright (c) Facebook, Inc. and its affiliates.
33
*/
44

5-
const siteConfig = require('./src/siteConfig').siteConfig;
6-
75
/**
86
* @type {import('next').NextConfig}
97
**/
@@ -16,22 +14,6 @@ const nextConfig = {
1614
legacyBrowsers: false,
1715
browsersListForSwc: true,
1816
},
19-
redirects() {
20-
const redirects = [];
21-
const languageCode = siteConfig.languageCode;
22-
const subdomain =
23-
languageCode === 'en' || !siteConfig.hasLegacySite
24-
? ''
25-
: languageCode + '.';
26-
return [
27-
{
28-
// Assume all *.html links are legacy site URLs.
29-
source: '/:path*(\\.html)',
30-
destination: `https://${subdomain}legacy.reactjs.org/:path*.html`,
31-
permanent: false,
32-
},
33-
];
34-
},
3517
env: {
3618
SANDPACK_BARE_COMPONENTS: process.env.SANDPACK_BARE_COMPONENTS,
3719
},
6.63 KB
Loading
7.12 KB
Loading

src/components/Seo.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@ export interface SeoProps {
1919

2020
const deployedTranslations = [
2121
'en',
22+
'zh-hans',
23+
'es',
2224
// We'll add more languages when they have enough content.
25+
// Please DO NOT edit this list without a discussion in the reactjs/react.dev repo.
26+
// It must be the same between all translations.
2327
];
2428

29+
let shouldPreventIndexing = false;
30+
if (
31+
siteConfig.languageCode !== 'en' &&
32+
!deployedTranslations.includes(siteConfig.languageCode)
33+
) {
34+
shouldPreventIndexing = true;
35+
}
36+
2537
function getDomain(languageCode: string): string {
2638
const subdomain = languageCode === 'en' ? '' : languageCode + '.';
2739
return subdomain + 'react.dev';
@@ -57,6 +69,7 @@ export const Seo = withRouter(
5769
href={canonicalUrl.replace(siteDomain, getDomain('en'))}
5870
hrefLang="x-default"
5971
/>
72+
{shouldPreventIndexing && <meta name="robots" content="noindex" />}
6073
{deployedTranslations.map((languageCode) => (
6174
<link
6275
key={'alt-' + languageCode}

src/content/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Offscreen is a low level capability that unlocks high level features. Similar to
6262

6363
## Transition Tracing {/*transition-tracing*/}
6464

65-
Currently, React has two profiling tools. The [original Profiler](https://reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html) shows an overview of all the commits in a profiling session. For each commit, it also shows all components that rendered and the amount of time it took for them to render. We also have a beta version of a [Timeline Profiler](https://github.com/reactwg/react-18/discussions/76) introduced in React 18 that shows when components schedule updates and when React works on these updates. Both of these profilers help developers identify performance problems in their code.
65+
Currently, React has two profiling tools. The [original Profiler](https://legacy.reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html) shows an overview of all the commits in a profiling session. For each commit, it also shows all components that rendered and the amount of time it took for them to render. We also have a beta version of a [Timeline Profiler](https://github.com/reactwg/react-18/discussions/76) introduced in React 18 that shows when components schedule updates and when React works on these updates. Both of these profilers help developers identify performance problems in their code.
6666

6767
We’ve realized that developers don’t find knowing about individual slow commits or components out of context that useful. It’s more useful to know about what actually causes the slow commits. And that developers want to be able to track specific interactions (eg a button click, an initial load, or a page navigation) to watch for performance regressions and to understand why an interaction was slow and how to fix it.
6868

src/content/community/versioning-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Instead, we release new features in minor versions. That means that minor releas
3030

3131
### Commitment to stability {/*commitment-to-stability*/}
3232

33-
As we change React over time, we try to minimize the effort required to take advantage of new features. When possible, we'll keep an older API working, even if that means putting it in a separate package. For example, [mixins have been discouraged for years](/blog/2016/07/13/mixins-considered-harmful.html) but they're supported to this day [via create-react-class](/docs/react-without-es6.html#mixins) and many codebases continue to use them in stable, legacy code.
33+
As we change React over time, we try to minimize the effort required to take advantage of new features. When possible, we'll keep an older API working, even if that means putting it in a separate package. For example, [mixins have been discouraged for years](https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html) but they're supported to this day [via create-react-class](https://legacy.reactjs.org/docs/react-without-es6.html#mixins) and many codebases continue to use them in stable, legacy code.
3434

3535
Over a million developers use React, collectively maintaining millions of components. The Facebook codebase alone has over 50,000 React components. That means we need to make it as easy as possible to upgrade to new versions of React; if we make large changes without a migration path, people will be stuck on old versions. We test these upgrade paths on Facebook itself – if our team of less than 10 people can update 50,000+ components alone, we hope the upgrade will be manageable for anyone using React. In many cases, we write [automated scripts](https://github.com/reactjs/react-codemod) to upgrade component syntax, which we then include in the open-source release for everyone to use.
3636

src/content/reference/react/memo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ There is no benefit to wrapping a component in `memo` in other cases. There is n
126126
1. Avoid [unnecessary Effects that update state.](/learn/you-might-not-need-an-effect) Most performance problems in React apps are caused by chains of updates originating from Effects that cause your components to render over and over.
127127
1. Try to [remove unnecessary dependencies from your Effects.](/learn/removing-effect-dependencies) For example, instead of memoization, it's often simpler to move some object or a function inside an Effect or outside the component.
128128

129-
If a specific interaction still feels laggy, [use the React Developer Tools profiler](/blog/2018/09/10/introducing-the-react-profiler.html) to see which components would benefit the most from memoization, and add memoization where needed. These principles make your components easier to debug and understand, so it's good to follow them in any case. In the long term, we're researching [doing granular memoization automatically](https://www.youtube.com/watch?v=lGEMwh32soc) to solve this once and for all.
129+
If a specific interaction still feels laggy, [use the React Developer Tools profiler](https://legacy.reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html) to see which components would benefit the most from memoization, and add memoization where needed. These principles make your components easier to debug and understand, so it's good to follow them in any case. In the long term, we're researching [doing granular memoization automatically](https://www.youtube.com/watch?v=lGEMwh32soc) to solve this once and for all.
130130

131131
</DeepDive>
132132

src/content/reference/react/useCallback.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Note that `useCallback` does not prevent *creating* the function. You're always
235235
1. Avoid [unnecessary Effects that update state.](/learn/you-might-not-need-an-effect) Most performance problems in React apps are caused by chains of updates originating from Effects that cause your components to render over and over.
236236
1. Try to [remove unnecessary dependencies from your Effects.](/learn/removing-effect-dependencies) For example, instead of memoization, it's often simpler to move some object or a function inside an Effect or outside the component.
237237
238-
If a specific interaction still feels laggy, [use the React Developer Tools profiler](/blog/2018/09/10/introducing-the-react-profiler.html) to see which components benefit the most from memoization, and add memoization where needed. These principles make your components easier to debug and understand, so it's good to follow them in any case. In long term, we're researching [doing memoization automatically](https://www.youtube.com/watch?v=lGEMwh32soc) to solve this once and for all.
238+
If a specific interaction still feels laggy, [use the React Developer Tools profiler](https://legacy.reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html) to see which components benefit the most from memoization, and add memoization where needed. These principles make your components easier to debug and understand, so it's good to follow them in any case. In long term, we're researching [doing memoization automatically](https://www.youtube.com/watch?v=lGEMwh32soc) to solve this once and for all.
239239
240240
</DeepDive>
241241

src/content/reference/react/useMemo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ There is no benefit to wrapping a calculation in `useMemo` in other cases. There
161161
1. Avoid [unnecessary Effects that update state.](/learn/you-might-not-need-an-effect) Most performance problems in React apps are caused by chains of updates originating from Effects that cause your components to render over and over.
162162
1. Try to [remove unnecessary dependencies from your Effects.](/learn/removing-effect-dependencies) For example, instead of memoization, it's often simpler to move some object or a function inside an Effect or outside the component.
163163

164-
If a specific interaction still feels laggy, [use the React Developer Tools profiler](/blog/2018/09/10/introducing-the-react-profiler.html) to see which components would benefit the most from memoization, and add memoization where needed. These principles make your components easier to debug and understand, so it's good to follow them in any case. In the long term, we're researching [doing granular memoization automatically](https://www.youtube.com/watch?v=lGEMwh32soc) to solve this once and for all.
164+
If a specific interaction still feels laggy, [use the React Developer Tools profiler](https://legacy.reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html) to see which components would benefit the most from memoization, and add memoization where needed. These principles make your components easier to debug and understand, so it's good to follow them in any case. In the long term, we're researching [doing granular memoization automatically](https://www.youtube.com/watch?v=lGEMwh32soc) to solve this once and for all.
165165

166166
</DeepDive>
167167

vercel.json

Lines changed: 0 additions & 270 deletions
Original file line numberDiff line numberDiff line change
@@ -4,271 +4,6 @@
44
},
55
"trailingSlash": false,
66
"redirects": [
7-
{
8-
"source": "/docs/add-react-to-a-website.html",
9-
"destination": "/learn/add-react-to-an-existing-project",
10-
"permanent": false
11-
},
12-
{
13-
"source": "/docs/create-a-new-react-app.html",
14-
"destination": "/learn/start-a-new-react-project",
15-
"permanent": false
16-
},
17-
{
18-
"source": "/docs/release-channels.html",
19-
"destination": "/community/versioning-policy",
20-
"permanent": false
21-
},
22-
{
23-
"source": "/docs/thinking-in-react.html",
24-
"destination": "/learn/thinking-in-react",
25-
"permanent": false
26-
},
27-
{
28-
"source": "/tutorial/tutorial.html",
29-
"destination": "/learn/tutorial-tic-tac-toe",
30-
"permanent": false
31-
},
32-
{
33-
"source": "/community/support.html",
34-
"destination": "/community",
35-
"permanent": false
36-
},
37-
{
38-
"source": "/community/conferences.html",
39-
"destination": "/community/conferences",
40-
"permanent": false
41-
},
42-
{
43-
"source": "/community/meetups.html",
44-
"destination": "/community/meetups",
45-
"permanent": false
46-
},
47-
{
48-
"source": "/community/team.html",
49-
"destination": "/community/team",
50-
"permanent": false
51-
},
52-
{
53-
"source": "/community/videos.html",
54-
"destination": "/community/videos",
55-
"permanent": false
56-
},
57-
{
58-
"source": "/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022.html",
59-
"destination": "/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022",
60-
"permanent": false
61-
},
62-
{
63-
"source": "/blog/2022/03/29/react-v18.html",
64-
"destination": "/blog/2022/03/29/react-v18",
65-
"permanent": false
66-
},
67-
{
68-
"source": "/blog/2022/03/08/react-18-upgrade-guide.html",
69-
"destination": "/blog/2022/03/08/react-18-upgrade-guide",
70-
"permanent": false
71-
},
72-
{
73-
"source": "/blog/2021/12/17/react-conf-2021-recap.html",
74-
"destination": "/blog/2021/12/17/react-conf-2021-recap",
75-
"permanent": false
76-
},
77-
{
78-
"source": "/blog/2021/06/08/the-plan-for-react-18.html",
79-
"destination": "/blog/2021/06/08/the-plan-for-react-18",
80-
"permanent": false
81-
},
82-
{
83-
"source": "/blog/2020/12/21/data-fetching-with-react-server-components.html",
84-
"destination": "/blog/2020/12/21/data-fetching-with-react-server-components",
85-
"permanent": false
86-
},
87-
{
88-
"source": "/tips/controlled-input-null-value.html",
89-
"destination": "/reference/react-dom/components/input#im-getting-an-error-a-component-is-changing-an-uncontrolled-input-to-be-controlled",
90-
"permanent": false
91-
},
92-
{
93-
"source": "/link/switch-to-createroot",
94-
"destination": "https://github.com/reactwg/react-18/discussions/5",
95-
"permanent": false
96-
},
97-
{
98-
"source": "/server-components",
99-
"destination": "/blog/2020/12/21/data-fetching-with-react-server-components",
100-
"permanent": false
101-
},
102-
{
103-
"source": "/concurrent",
104-
"destination": "/blog/2022/03/29/react-v18",
105-
"permanent": false
106-
},
107-
{
108-
"source": "/hooks",
109-
"destination": "/reference/react",
110-
"permanent": false
111-
},
112-
{
113-
"source": "/tutorial",
114-
"destination": "/learn/tutorial-tic-tac-toe",
115-
"permanent": false
116-
},
117-
{
118-
"source": "/link/attribute-behavior",
119-
"destination": "https://legacy.reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html#changes-in-detail",
120-
"permanent": false
121-
},
122-
{
123-
"source": "/link/controlled-components",
124-
"destination": "/reference/react-dom/components/input#controlling-an-input-with-a-state-variable",
125-
"permanent": false
126-
},
127-
{
128-
"source": "/link/crossorigin-error",
129-
"destination": "https://legacy.reactjs.org/docs/cross-origin-errors.html",
130-
"permanent": false
131-
},
132-
{
133-
"source": "/link/dangerously-set-inner-html",
134-
"destination": "/reference/react-dom/components/common#dangerously-setting-the-inner-html",
135-
"permanent": false
136-
},
137-
{
138-
"source": "/link/derived-state",
139-
"destination": "https://legacy.reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html",
140-
"permanent": false
141-
},
142-
{
143-
"source": "/link/error-boundaries",
144-
"destination": "https://legacy.reactjs.org/docs/error-boundaries.html",
145-
"permanent": false
146-
},
147-
{
148-
"source": "/link/event-pooling",
149-
"destination": "https://legacy.reactjs.org/docs/legacy-event-pooling.html",
150-
"permanent": false
151-
},
152-
{
153-
"source": "/link/hooks-data-fetching",
154-
"destination": "/reference/react/useEffect#fetching-data-with-effects",
155-
"permanent": false
156-
},
157-
{
158-
"source": "/link/invalid-aria-props",
159-
"destination": "/warnings/invalid-aria-prop",
160-
"permanent": false
161-
},
162-
{
163-
"source": "/link/invalid-hook-call",
164-
"destination": "/warnings/invalid-hook-call-warning",
165-
"permanent": false
166-
},
167-
{
168-
"source": "/link/legacy-context",
169-
"destination": "https://legacy.reactjs.org/docs/legacy-context.html",
170-
"permanent": false
171-
},
172-
{
173-
"source": "/link/legacy-factories",
174-
"destination": "https://legacy.reactjs.org/warnings/legacy-factories.html",
175-
"permanent": false
176-
},
177-
{
178-
"source": "/link/perf-use-production-build",
179-
"destination": "https://legacy.reactjs.org/docs/optimizing-performance.html#use-the-production-build",
180-
"permanent": false
181-
},
182-
{
183-
"source": "/link/react-devtools",
184-
"destination": "/learn/react-developer-tools",
185-
"permanent": false
186-
},
187-
{
188-
"source": "/link/react-polyfills",
189-
"destination": "https://legacy.reactjs.org/docs/javascript-environment-requirements.html",
190-
"permanent": false
191-
},
192-
{
193-
"source": "/link/refs-must-have-owner",
194-
"destination": "https://legacy.reactjs.org/warnings/refs-must-have-owner.html",
195-
"permanent": false
196-
},
197-
{
198-
"source": "/link/rules-of-hooks",
199-
"destination": "/warnings/invalid-hook-call-warning",
200-
"permanent": false
201-
},
202-
{
203-
"source": "/link/special-props",
204-
"destination": "/warnings/special-props",
205-
"permanent": false
206-
},
207-
{
208-
"source": "/link/strict-mode-find-node",
209-
"destination": "/reference/react-dom/findDOMNode#alternatives",
210-
"permanent": false
211-
},
212-
{
213-
"source": "/link/strict-mode-string-ref",
214-
"destination": "https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs",
215-
"permanent": false
216-
},
217-
{
218-
"source": "/link/unsafe-component-lifecycles",
219-
"destination": "https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html",
220-
"permanent": false
221-
},
222-
{
223-
"source": "/link/warning-keys",
224-
"destination": "/learn/rendering-lists#keeping-list-items-in-order-with-key",
225-
"permanent": false
226-
},
227-
{
228-
"source": "/link/wrap-tests-with-act",
229-
"destination": "https://legacy.reactjs.org/docs/test-utils.html#act",
230-
"permanent": false
231-
},
232-
{
233-
"source": "/link/interaction-tracing",
234-
"destination": "https://gist.github.com/bvaughn/8de925562903afd2e7a12554adcdda16",
235-
"permanent": false
236-
},
237-
{
238-
"source": "/link/profiling",
239-
"destination": "https://gist.github.com/bvaughn/25e6233aeb1b4f0cdb8d8366e54a3977",
240-
"permanent": false
241-
},
242-
{
243-
"source": "/link/test-utils-mock-component",
244-
"destination": "https://gist.github.com/bvaughn/fbf41b3f895bf2d297935faa5525eee9",
245-
"permanent": false
246-
},
247-
{
248-
"source": "/link/uselayouteffect-ssr",
249-
"destination": "https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85",
250-
"permanent": false
251-
},
252-
{
253-
"source": "/link/react-devtools-faq",
254-
"destination": "https://github.com/facebook/react/tree/main/packages/react-devtools#faq",
255-
"permanent": false
256-
},
257-
{
258-
"source": "/link/setstate-in-render",
259-
"destination": "https://github.com/facebook/react/issues/18178#issuecomment-595846312",
260-
"permanent": false
261-
},
262-
{
263-
"source": "/version/15.6",
264-
"destination": "https://react-legacy.netlify.app",
265-
"permanent": false
266-
},
267-
{
268-
"source": "/apis/:path*",
269-
"destination": "/reference/:path*",
270-
"permanent": true
271-
},
2727
{
2738
"source": "/reference",
2749
"destination": "/reference/react",
@@ -278,11 +13,6 @@
27813
"source": "/learn/meet-the-team",
27914
"destination": "/community/team",
28015
"permanent": true
281-
},
282-
{
283-
"source": "/learn/add-react-to-a-website",
284-
"destination": "/learn/add-react-to-an-existing-project",
285-
"permanent": true
28616
}
28717
],
28818
"headers": [

0 commit comments

Comments
 (0)