@@ -610,11 +610,17 @@ function ChatRoom({ roomId }) {
610610
611611### 你想读取一个值而不对其变化做出“反应”吗? {/*do-you-want-to-read-a-value-without-reacting-to-its-changes*/}
612612
613- <Wip >
613+ <Canary >
614614
615+ <<<<<<< HEAD
615616本节描述了一个在稳定版本的 React 中 **尚未发布的实验性** API。
617+ =======
618+ **The ` useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
619+ >>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
616620
617- </Wip>
621+ [Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
622+
623+ </Canary>
618624
619625假设你希望在用户收到新消息时播放声音,` isMuted` 为 ` true ` 除外:
620626
@@ -1261,8 +1267,8 @@ Effect 中是否有一行代码不应该是响应式的?如何将非响应式
12611267` ` ` json package .json hidden
12621268{
12631269 " dependencies" : {
1264- " react" : " experimental " ,
1265- " react-dom" : " experimental " ,
1270+ " react" : " canary " ,
1271+ " react-dom" : " canary " ,
12661272 " react-scripts" : " latest"
12671273 },
12681274 " scripts" : {
@@ -1276,7 +1282,7 @@ Effect 中是否有一行代码不应该是响应式的?如何将非响应式
12761282
12771283` ` ` js
12781284import { useState , useEffect , useRef } from ' react' ;
1279- import { experimental_useEffectEvent as useEffectEvent } from ' react' ;
1285+ import { useEffectEvent } from ' react' ;
12801286import { FadeInAnimation } from ' ./animation.js' ;
12811287
12821288function Welcome ({ duration }) {
@@ -1388,8 +1394,8 @@ Effect 需要读取 `duration` 的最新值,但你不希望它对 `duration`
13881394` ` ` json package .json hidden
13891395{
13901396 " dependencies" : {
1391- " react" : " experimental " ,
1392- " react-dom" : " experimental " ,
1397+ " react" : " canary " ,
1398+ " react-dom" : " canary " ,
13931399 " react-scripts" : " latest"
13941400 },
13951401 " scripts" : {
@@ -1404,7 +1410,7 @@ Effect 需要读取 `duration` 的最新值,但你不希望它对 `duration`
14041410` ` ` js
14051411import { useState , useEffect , useRef } from ' react' ;
14061412import { FadeInAnimation } from ' ./animation.js' ;
1407- import { experimental_useEffectEvent as useEffectEvent } from ' react' ;
1413+ import { useEffectEvent } from ' react' ;
14081414
14091415function Welcome ({ duration }) {
14101416 const ref = useRef (null );
@@ -1824,8 +1830,8 @@ label, button { display: block; margin-bottom: 5px; }
18241830` ` ` json package .json hidden
18251831{
18261832 " dependencies" : {
1827- " react" : " experimental " ,
1828- " react-dom" : " experimental " ,
1833+ " react" : " canary " ,
1834+ " react-dom" : " canary " ,
18291835 " react-scripts" : " latest" ,
18301836 " toastify-js" : " 1.12.0"
18311837 },
@@ -1906,7 +1912,7 @@ export default function App() {
19061912
19071913` ` ` js src/ ChatRoom .js active
19081914import { useState , useEffect } from ' react' ;
1909- import { experimental_useEffectEvent as useEffectEvent } from ' react' ;
1915+ import { useEffectEvent } from ' react' ;
19101916
19111917export default function ChatRoom ({ roomId, createConnection, onMessage }) {
19121918 useEffect (() => {
@@ -2119,8 +2125,8 @@ export default function ChatRoom({ roomId, isEncrypted, onMessage }) { // Reacti
21192125` ` ` json package .json hidden
21202126{
21212127 " dependencies" : {
2122- " react" : " experimental " ,
2123- " react-dom" : " experimental " ,
2128+ " react" : " canary " ,
2129+ " react-dom" : " canary " ,
21242130 " react-scripts" : " latest" ,
21252131 " toastify-js" : " 1.12.0"
21262132 },
@@ -2188,7 +2194,7 @@ export default function App() {
21882194
21892195` ` ` js src/ ChatRoom .js active
21902196import { useState , useEffect } from ' react' ;
2191- import { experimental_useEffectEvent as useEffectEvent } from ' react' ;
2197+ import { useEffectEvent } from ' react' ;
21922198import {
21932199 createEncryptedConnection ,
21942200 createUnencryptedConnection ,
0 commit comments