Skip to content

Commit 4bf7566

Browse files
authored
Merge branch 'main' into sync-9aa2e366
2 parents c14d990 + defee7b commit 4bf7566

16 files changed

Lines changed: 1219 additions & 1170 deletions

File tree

.github/workflows/analyze.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ jobs:
1111
analyze:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

1616
- name: Set up node
17-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v3
1818
with:
1919
node-version: '20.x'
2020

2121
- name: Install dependencies
2222
uses: bahmutov/npm-install@v1.7.10
2323

2424
- name: Restore next build
25-
uses: actions/cache@v2
25+
uses: actions/cache@v3
2626
id: restore-build-cache
2727
env:
2828
cache-name: cache-next-build
@@ -41,7 +41,7 @@ jobs:
4141
run: npx -p nextjs-bundle-analysis@0.5.0 report
4242

4343
- name: Upload bundle
44-
uses: actions/upload-artifact@v2
44+
uses: actions/upload-artifact@v3
4545
with:
4646
path: .next/analyze/__bundle_analysis.json
4747
name: bundle_analysis.json
@@ -73,7 +73,7 @@ jobs:
7373
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
7474

7575
- name: Upload analysis comment
76-
uses: actions/upload-artifact@v2
76+
uses: actions/upload-artifact@v3
7777
with:
7878
name: analysis_comment.txt
7979
path: .next/analyze/__bundle_analysis_comment.txt
@@ -82,7 +82,7 @@ jobs:
8282
run: echo ${{ github.event.number }} > ./pr_number
8383

8484
- name: Upload PR number
85-
uses: actions/upload-artifact@v2
85+
uses: actions/upload-artifact@v3
8686
with:
8787
name: pr_number
8888
path: ./pr_number

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
},
2525
"dependencies": {
2626
"@codesandbox/sandpack-react": "2.13.5",
27-
"@docsearch/css": "3.0.0-alpha.41",
28-
"@docsearch/react": "3.0.0-alpha.41",
27+
"@docsearch/css": "^3.6.1",
28+
"@docsearch/react": "^3.6.1",
2929
"@headlessui/react": "^1.7.0",
3030
"@radix-ui/react-context-menu": "^2.1.5",
3131
"body-scroll-lock": "^3.1.3",

public/rss.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<description><![CDATA[This blog is the official source for the updates from the React team. Anything important, including release notes or deprecation notices, will be posted here first.]]></description>
55
<link>https://react.dev/</link>
66
<generator>react.dev rss module</generator>
7-
<lastBuildDate>Tue, 20 Aug 2024 08:06:26 GMT</lastBuildDate>
7+
<lastBuildDate>Tue, 15 Oct 2024 17:49:58 GMT</lastBuildDate>
88
<atom:link href="https://react.dev/rss.xml" rel="self" type="application/rss+xml"/>
9-
<pubDate>Tue, 20 Aug 2024 08:06:26 GMT</pubDate>
9+
<pubDate>Tue, 15 Oct 2024 17:49:58 GMT</pubDate>
1010
<language><![CDATA[en]]></language>
1111
<item>
1212
<title><![CDATA[React Conf 2024 Recap]]></title>

src/components/Layout/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export function Footer() {
283283
<div
284284
className="text-xs text-left rtl:text-right mt-2 pe-0.5"
285285
dir="ltr">
286-
&copy;{new Date().getFullYear()}
286+
Copyright &copy; Meta Platforms, Inc
287287
</div>
288288
<div
289289
className="uwu-visible text-xs cursor-pointer hover:text-link hover:dark:text-link-dark hover:underline"

src/components/Search.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,17 @@ export function Search({
9494
onOpen,
9595
onClose,
9696
searchParameters = {
97-
hitsPerPage: 5,
97+
hitsPerPage: 30,
98+
attributesToHighlight: [
99+
'hierarchy.lvl0',
100+
'hierarchy.lvl1',
101+
'hierarchy.lvl2',
102+
'hierarchy.lvl3',
103+
'hierarchy.lvl4',
104+
'hierarchy.lvl5',
105+
'hierarchy.lvl6',
106+
'content',
107+
],
98108
},
99109
}: SearchProps) {
100110
useDocSearchKeyboardEvents({isOpen, onOpen, onClose});

src/content/community/conferences.md

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -10,81 +10,6 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c
1010

1111
## Upcoming Conferences {/*upcoming-conferences*/}
1212

13-
<<<<<<< HEAD
14-
### React Paris 2024 {/*react-paris-2024*/}
15-
March 22, 2024. In-person in Paris, France + Remote (hybrid)
16-
17-
[Website](https://react.paris/) - [Twitter](https://twitter.com/BeJS_) - [LinkedIn](https://www.linkedin.com/events/7150816372074192900/comments/)
18-
19-
### Epic Web Conf 2024 {/*epic-web-2024*/}
20-
April 10 - 11, 2024. In-person in Park City, UT, USA
21-
22-
[Website](https://www.epicweb.dev/conf) - [YouTube](https://www.youtube.com/@EpicWebDev)
23-
24-
### React Miami 2024 {/*react-miami-2024*/}
25-
April 19 - 20, 2024. In-person in Miami, FL, USA
26-
27-
[Website](https://reactmiami.com/) - [Twitter](https://twitter.com/ReactMiamiConf)
28-
29-
### React Connection 2024 {/*react-connection-2024*/}
30-
April 22, 2024. In-person in Paris, France
31-
32-
[Website](https://reactconnection.io/) - [Twitter](https://twitter.com/ReactConn)
33-
34-
### React Native Connection 2024 {/*react-native-connection-2024*/}
35-
April 23, 2024. In-person in Paris, France
36-
37-
[Website](https://reactnativeconnection.io/) - [Twitter](https://twitter.com/ReactNativeConn)
38-
39-
### React Conf 2024 {/*react-conf-2024*/}
40-
May 15 - 16, 2024. In-person in Henderson, NV, USA + remote
41-
42-
[Website](https://conf.react.dev) - [Twitter](https://twitter.com/reactjs)
43-
44-
### App.js Conf 2024 {/*appjs-conf-2024*/}
45-
May 22 - 24, 2024. In-person in Kraków, Poland + remote
46-
47-
[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)
48-
49-
50-
### Frontend Nation 2024 {/*frontend-nation-2024*/}
51-
June 4 - 7, 2024. Online
52-
53-
[Website](https://frontendnation.com/) - [Twitter](https://twitter.com/frontendnation)
54-
55-
### React Summit 2024 {/*react-summit-2024*/}
56-
June 14 & 18, 2024. In-person in Amsterdam, Netherlands + remote (hybrid event)
57-
58-
[Website](https://reactsummit.com/) - [Twitter](https://twitter.com/reactsummit) - [Videos](https://portal.gitnation.org/)
59-
60-
### Render(ATL) 2024 🍑 {/*renderatl-2024-*/}
61-
June 12 - June 14, 2024. Atlanta, GA, USA
62-
63-
[Website](https://renderatl.com) - [Discord](https://www.renderatl.com/discord) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl) - [Podcast](https://www.renderatl.com/culture-and-code#/)
64-
65-
### React Norway 2024 {/*react-norway-2024*/}
66-
June 14, 2024. In-person at Farris Bad Hotel in Larvik, Norway and online (hybrid event).
67-
68-
[Website](https://reactnorway.com/) - [Twitter](https://twitter.com/ReactNorway)
69-
70-
71-
### React Nexus 2024 {/*react-nexus-2024*/}
72-
July 04 & 05, 2024. Bangalore, India (In-person event)
73-
74-
[Website](https://reactnexus.com/) - [Twitter](https://twitter.com/ReactNexus) - [Linkedin](https://www.linkedin.com/company/react-nexus) - [YouTube](https://www.youtube.com/reactify_in)
75-
76-
### Chain React 2024 {/*chain-react-2024*/}
77-
July 17-19, 2024. In-person in Portland, OR, USA
78-
79-
[Website](https://chainreactconf.com) - [Twitter](https://twitter.com/ChainReactConf)
80-
81-
### The Geek Conf 2024 {/*the-geek-conf-2024*/}
82-
July 25, 2024. In-person in Berlin, Germany + remote (hybrid event)
83-
84-
[Website](https://thegeekconf.com) - [Twitter](https://twitter.com/thegeekconf)
85-
86-
=======
87-
>>>>>>> 9aa2e3668da290f92f8997a25f28bd3f58b2a26d
8813
### React Universe Conf 2024 {/*react-universe-conf-2024*/}
8914
September 5-6, 2024. Wrocław, Poland.
9015

@@ -105,20 +30,26 @@ October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - re
10530

10631
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
10732

108-
<<<<<<< HEAD
109-
## Past Conferences {/*past-conferences*/}
110-
111-
=======
11233
### React Brussels 2024 {/*react-brussels-2024*/}
11334
October 18, 2024. In-person in Brussels, Belgium (hybrid event)
11435

11536
[Website](https://www.react.brussels/) - [Twitter](https://x.com/BrusselsReact)
11637

38+
### reactjsday 2024 {/*reactjsday-2024*/}
39+
October 25, 2024. In-person in Verona, Italy + online (hybrid event)
40+
41+
[Website](https://2024.reactjsday.it/) - [Twitter](https://x.com/reactjsday) - [Facebook](https://www.facebook.com/GrUSP/) - [YouTube](https://www.youtube.com/c/grusp)
42+
11743
### React Advanced London 2024 {/*react-advanced-london-2024*/}
11844
October 25 & 28, 2024. In-person in London, UK + online (hybrid event)
11945

12046
[Website](https://reactadvanced.com/) - [Twitter](https://x.com/reactadvanced)
12147

48+
### React Native London Conf 2024 {/*react-native-london-2024*/}
49+
November 14 & 15, 2024. In-person in London, UK
50+
51+
[Website](https://reactnativelondon.co.uk/) - [Twitter](https://x.com/RNLConf)
52+
12253
### React Summit US 2024 {/*react-summit-us-2024*/}
12354
November 19 & 22, 2024. In-person in New York, USA + online (hybrid event)
12455

@@ -171,7 +102,6 @@ June 12 - June 14, 2024. Atlanta, GA, USA
171102

172103
[Website](https://renderatl.com) - [Discord](https://www.renderatl.com/discord) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl) - [Podcast](https://www.renderatl.com/culture-and-code#/)
173104

174-
>>>>>>> 9aa2e3668da290f92f8997a25f28bd3f58b2a26d
175105
### Frontend Nation 2024 {/*frontend-nation-2024*/}
176106
June 4 - 7, 2024. Online
177107

@@ -205,7 +135,7 @@ April 10 - 11, 2024. In-person in Park City, UT, USA
205135
### React Paris 2024 {/*react-paris-2024*/}
206136
March 22, 2024. In-person in Paris, France + Remote (hybrid)
207137

208-
[Website](https://react.paris/) - [Twitter](https://twitter.com/BeJS_) - [LinkedIn](https://www.linkedin.com/events/7150816372074192900/comments/)
138+
[Website](https://react.paris/) - [Twitter](https://twitter.com/BeJS_) - [LinkedIn](https://www.linkedin.com/events/7150816372074192900/comments/) - [Videos](https://www.youtube.com/playlist?list=PL53Z0yyYnpWhUzgvr2Nys3kZBBLcY0TA7)
209139

210140
### React Day Berlin 2023 {/*react-day-berlin-2023*/}
211141
December 8 & 12, 2023. In-person in Berlin, Germany + remote first interactivity (hybrid event)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ function Game() {
408408
409409
There are two problems with this code.
410410
411-
First problem is that it is very inefficient: the component (and its children) have to re-render between each `set` call in the chain. In the example above, in the worst case (`setCard` → render → `setGoldCardCount` → render → `setRound` → render → `setIsGameOver` → render) there are three unnecessary re-renders of the tree below.
411+
The first problem is that it is very inefficient: the component (and its children) have to re-render between each `set` call in the chain. In the example above, in the worst case (`setCard` → render → `setGoldCardCount` → render → `setRound` → render → `setIsGameOver` → render) there are three unnecessary re-renders of the tree below.
412412
413413
The second problem is that even if it weren't slow, as your code evolves, you will run into cases where the "chain" you wrote doesn't fit the new requirements. Imagine you are adding a way to step through the history of the game moves. You'd do it by updating each state variable to a value from the past. However, setting the `card` state to a value from the past would trigger the Effect chain again and change the data you're showing. Such code is often rigid and fragile.
414414

src/content/reference/react/useCallback.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ function ChatRoom({ roomId }) {
711711

712712
useEffect(() => {
713713
const options = createOptions();
714-
const connection = createConnection();
714+
const connection = createConnection(options);
715715
connection.connect();
716716
// ...
717717
```
@@ -722,7 +722,7 @@ This creates a problem. [Every reactive value must be declared as a dependency o
722722
```js {6}
723723
useEffect(() => {
724724
const options = createOptions();
725-
const connection = createConnection();
725+
const connection = createConnection(options);
726726
connection.connect();
727727
return () => connection.disconnect();
728728
}, [createOptions]); // 🔴 Problem: This dependency changes on every render
@@ -744,7 +744,7 @@ function ChatRoom({ roomId }) {
744744

745745
useEffect(() => {
746746
const options = createOptions();
747-
const connection = createConnection();
747+
const connection = createConnection(options);
748748
connection.connect();
749749
return () => connection.disconnect();
750750
}, [createOptions]); // ✅ Only changes when createOptions changes
@@ -766,7 +766,7 @@ function ChatRoom({ roomId }) {
766766
}
767767

768768
const options = createOptions();
769-
const connection = createConnection();
769+
const connection = createConnection(options);
770770
connection.connect();
771771
return () => connection.disconnect();
772772
}, [roomId]); // ✅ Only changes when roomId changes

src/content/reference/react/useMemo.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,83 @@ Keep in mind that you need to run React in production mode, disable [React Devel
10561056

10571057
---
10581058

1059+
### Preventing an Effect from firing too often {/*preventing-an-effect-from-firing-too-often*/}
1060+
1061+
Sometimes, you might want to use a value inside an [Effect:](/learn/synchronizing-with-effects)
1062+
1063+
```js {4-7,10}
1064+
function ChatRoom({ roomId }) {
1065+
const [message, setMessage] = useState('');
1066+
1067+
const options = {
1068+
serverUrl: 'https://localhost:1234',
1069+
roomId: roomId
1070+
}
1071+
1072+
useEffect(() => {
1073+
const connection = createConnection(options);
1074+
connection.connect();
1075+
// ...
1076+
```
1077+
1078+
This creates a problem. [Every reactive value must be declared as a dependency of your Effect.](/learn/lifecycle-of-reactive-effects#react-verifies-that-you-specified-every-reactive-value-as-a-dependency) However, if you declare `options` as a dependency, it will cause your Effect to constantly reconnect to the chat room:
1079+
1080+
1081+
```js {5}
1082+
useEffect(() => {
1083+
const connection = createConnection(options);
1084+
connection.connect();
1085+
return () => connection.disconnect();
1086+
}, [options]); // 🔴 Problem: This dependency changes on every render
1087+
// ...
1088+
```
1089+
1090+
To solve this, you can wrap the object you need to call from an Effect in `useMemo`:
1091+
1092+
```js {4-9,16}
1093+
function ChatRoom({ roomId }) {
1094+
const [message, setMessage] = useState('');
1095+
1096+
const options = useMemo(() => {
1097+
return {
1098+
serverUrl: 'https://localhost:1234',
1099+
roomId: roomId
1100+
};
1101+
}, [roomId]); // ✅ Only changes when roomId changes
1102+
1103+
useEffect(() => {
1104+
const options = createOptions();
1105+
const connection = createConnection(options);
1106+
connection.connect();
1107+
return () => connection.disconnect();
1108+
}, [options]); // ✅ Only changes when createOptions changes
1109+
// ...
1110+
```
1111+
1112+
This ensures that the `options` object is the same between re-renders if `useMemo` returns the cached object.
1113+
1114+
However, since `useMemo` is performance optimization, not a semantic guarantee, React may throw away the cached value if [there is a specific reason to do that](#caveats). This will also cause the effect to re-fire, **so it's even better to remove the need for a function dependency** by moving your object *inside* the Effect:
1115+
1116+
```js {5-8,13}
1117+
function ChatRoom({ roomId }) {
1118+
const [message, setMessage] = useState('');
1119+
1120+
useEffect(() => {
1121+
const options = { // ✅ No need for useMemo or object dependencies!
1122+
serverUrl: 'https://localhost:1234',
1123+
roomId: roomId
1124+
}
1125+
1126+
const connection = createConnection(options);
1127+
connection.connect();
1128+
return () => connection.disconnect();
1129+
}, [roomId]); // ✅ Only changes when roomId changes
1130+
// ...
1131+
```
1132+
1133+
Now your code is simpler and doesn't need `useMemo`. [Learn more about removing Effect dependencies.](/learn/removing-effect-dependencies#move-dynamic-objects-and-functions-inside-your-effect)
1134+
1135+
10591136
### Memoizing a dependency of another Hook {/*memoizing-a-dependency-of-another-hook*/}
10601137
10611138
Suppose you have a calculation that depends on an object created directly in the component body:

src/content/reference/react/useReducer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function MyComponent() {
5252
#### Caveats {/*caveats*/}
5353
5454
* `useReducer` is a Hook, so you can only call it **at the top level of your component** or your own Hooks. You can't call it inside loops or conditions. If you need that, extract a new component and move the state into it.
55+
* The `dispatch` function has a stable identity, so you will often see it omitted from effect dependencies, but including it will not cause the effect to fire. If the linter lets you omit a dependency without errors, it is safe to do. [Learn more about removing Effect dependencies.](/learn/removing-effect-dependencies#move-dynamic-objects-and-functions-inside-your-effect)
5556
* In Strict Mode, React will **call your reducer and initializer twice** in order to [help you find accidental impurities.](#my-reducer-or-initializer-function-runs-twice) This is development-only behavior and does not affect production. If your reducer and initializer are pure (as they should be), this should not affect your logic. The result from one of the calls is ignored.
5657
5758
---

0 commit comments

Comments
 (0)