Skip to content

Commit dae817f

Browse files
authored
[Beta] Update the useSyncExternalStore link (#5030)
1 parent 8a1a82b commit dae817f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beta/src/content/learn/you-might-not-need-an-effect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ function ChatIndicator() {
656656
657657
Here, the component subscribes to an external data store (in this case, the browser `navigator.onLine` API). Since this API does not exist on the server (so it can't be used to generate the initial HTML), initially the state is set to `true`. Whenever the value of that data store changes in the browser, the component updates its state.
658658
659-
Although it's common to use Effects for this, React has a purpose-built Hook for subscribing to an external store that is preferred instead. Delete the Effect and replace it with a call to [`useSyncExternalStore`](/apis/react/usesyncexternalstore):
659+
Although it's common to use Effects for this, React has a purpose-built Hook for subscribing to an external store that is preferred instead. Delete the Effect and replace it with a call to [`useSyncExternalStore`](/apis/react/useSyncExternalStore):
660660
661661
```js {11-16}
662662
function subscribe(callback) {

0 commit comments

Comments
 (0)