Read and subscribe to an external store consistently.
Section: Performance and Concurrency Hooks
useSyncExternalStore subscribe to external state
tsx
tsx
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);Explanation
For libraries or app code integrating with non-React stores while preserving concurrent rendering correctness.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Performance and Concurrency Hooks
useDeferredValue delay expensive rendering
Defer a value so expensive children lag behind urgent input.
use API with context or promise
Read context or promise values with the `use` API.