React integration
useSyncExternalStore
Reads a changing value from an external source through a subscription and snapshot reader.
Formal Syntax & Structure
react syntaxreact
useSyncExternalStore(store.subscribe, store.getSnapshot)Working Example
Example Snippetreact
useSyncExternalStore(store.subscribe, store.getSnapshot)