Skip to content

Commit 0f8bd80

Browse files
authored
Code example mistake in useMemo page (#7335)
1 parent 807e7fa commit 0f8bd80

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/content/reference/react/useMemo.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,10 @@ function ChatRoom({ roomId }) {
11011101
}, [roomId]); // ✅ Only changes when roomId changes
11021102

11031103
useEffect(() => {
1104-
const options = createOptions();
11051104
const connection = createConnection(options);
11061105
connection.connect();
11071106
return () => connection.disconnect();
1108-
}, [options]); // ✅ Only changes when createOptions changes
1107+
}, [options]); // ✅ Only changes when options changes
11091108
// ...
11101109
```
11111110

0 commit comments

Comments
 (0)