From 27b9df7d3a87b5f6b727ae6491833d7a9e880b93 Mon Sep 17 00:00:00 2001 From: Sleepwf Date: Sat, 16 Aug 2025 21:50:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=A0=B9=E6=8D=AEissues#1731?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=85=B3=E4=BA=8EuseSyncExternalSto?= =?UTF-8?q?re=20=E4=B8=AD=20subscribe=20=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据issues#1731修改了关于useSyncExternalStore 中 subscribe 参数的翻译 --- src/content/reference/react/useSyncExternalStore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/useSyncExternalStore.md b/src/content/reference/react/useSyncExternalStore.md index da0696164b..7d6eed2547 100644 --- a/src/content/reference/react/useSyncExternalStore.md +++ b/src/content/reference/react/useSyncExternalStore.md @@ -41,7 +41,7 @@ function TodosApp() { #### 参数 {/*parameters*/} -* `subscribe`:一个函数,接收一个单独的 `callback` 参数并把它订阅到 store 上。当 store 发生改变时会调用提供的 `callback`,这将导致 React 重新调用 `getSnapshot` 并在需要的时候重新渲染组件。`subscribe` 函数会返回清除订阅的函数。 +* `subscribe`:一个函数,接收一个单独的 `callback` 参数并把它订阅到 store 上。当 store 发生改变时应该调用提供的 `callback`,这将导致 React 重新调用 `getSnapshot` 并在需要的时候重新渲染组件。`subscribe` 函数会返回清除订阅的函数。 * `getSnapshot`:一个函数,返回组件需要的 store 中的数据快照。在 store 不变的情况下,重复调用 `getSnapshot` 必须返回同一个值。如果 store 改变,并且返回值也不同了(用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 比较),React 就会重新渲染组件。 From 9ac94d572b214da52c37c62ff556435b2bf9cc4c Mon Sep 17 00:00:00 2001 From: Sleepwf Date: Sat, 16 Aug 2025 22:11:44 +0800 Subject: [PATCH 2/2] fix: the translation of the subscribe parameter in useSyncExternalStore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据issues#1731修改了关于useSyncExternalStore 中 subscribe 参数的翻译 Co-authored-by: Xavi Lee --- src/content/reference/react/useSyncExternalStore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/useSyncExternalStore.md b/src/content/reference/react/useSyncExternalStore.md index 7d6eed2547..e44e9d3a2d 100644 --- a/src/content/reference/react/useSyncExternalStore.md +++ b/src/content/reference/react/useSyncExternalStore.md @@ -41,7 +41,7 @@ function TodosApp() { #### 参数 {/*parameters*/} -* `subscribe`:一个函数,接收一个单独的 `callback` 参数并把它订阅到 store 上。当 store 发生改变时应该调用提供的 `callback`,这将导致 React 重新调用 `getSnapshot` 并在需要的时候重新渲染组件。`subscribe` 函数会返回清除订阅的函数。 +* `subscribe`:一个函数,接收一个单独的 `callback` 参数并把它订阅到 store 上。当 store 发生改变时应该调用提供的 `callback`,这将使 React 重新调用 `getSnapshot` 并在需要的时候重新渲染组件。`subscribe` 函数会返回清除订阅的函数。 * `getSnapshot`:一个函数,返回组件需要的 store 中的数据快照。在 store 不变的情况下,重复调用 `getSnapshot` 必须返回同一个值。如果 store 改变,并且返回值也不同了(用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 比较),React 就会重新渲染组件。