Skip to content

Commit

Permalink
Changed the documentation of the subscribe argument to a more accurat…
Browse files Browse the repository at this point in the history
…… (#6691)

* Changed the documentation of the subscribe argument to a more accurate one.

* Update useSyncExternalStore.md

---------

Co-authored-by: Sophie Alpert <git@sophiebits.com>
  • Loading branch information
Tinttori and sophiebits committed Sep 8, 2024
1 parent 60ef58c commit 9aa2e36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content/reference/react/useSyncExternalStore.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ It returns the snapshot of the data in the store. You need to pass two functions
#### Parameters {/*parameters*/}
* `subscribe`: A function that takes a single `callback` argument and subscribes it to the store. When the store changes, it should invoke the provided `callback`. This will cause the component to re-render. The `subscribe` function should return a function that cleans up the subscription.
* `subscribe`: A function that takes a single `callback` argument and subscribes it to the store. When the store changes, it should invoke the provided `callback`, which will cause React to re-call `getSnapshot` and (if needed) re-render the component. The `subscribe` function should return a function that cleans up the subscription.
* `getSnapshot`: A function that returns a snapshot of the data in the store that's needed by the component. While the store has not changed, repeated calls to `getSnapshot` must return the same value. If the store changes and the returned value is different (as compared by [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)), React re-renders the component.
Expand Down

0 comments on commit 9aa2e36

Please sign in to comment.