Skip to content

Commit e5d1026

Browse files
fix: the translation of the subscribe parameter in useSyncExternalStore (#1745)
Co-authored-by: Xavi Lee <xavilee2002@outlook.com>
1 parent 7e9e735 commit e5d1026

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/reference/react/useSyncExternalStore.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function TodosApp() {
4141
4242
#### 参数 {/*parameters*/}
4343
44-
* `subscribe`:一个函数,接收一个单独的 `callback` 参数并把它订阅到 store 上。当 store 发生改变时会调用提供的 `callback`这将导致 React 重新调用 `getSnapshot` 并在需要的时候重新渲染组件。`subscribe` 函数会返回清除订阅的函数。
44+
* `subscribe`:一个函数,接收一个单独的 `callback` 参数并把它订阅到 store 上。当 store 发生改变时应该调用提供的 `callback`这将使 React 重新调用 `getSnapshot` 并在需要的时候重新渲染组件。`subscribe` 函数会返回清除订阅的函数。
4545
4646
* `getSnapshot`:一个函数,返回组件需要的 store 中的数据快照。在 store 不变的情况下,重复调用 `getSnapshot` 必须返回同一个值。如果 store 改变,并且返回值也不同了(用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 比较),React 就会重新渲染组件。
4747

0 commit comments

Comments
 (0)