external store
State held outside React, in a library, a module variable or a browser API, which components subscribe to for changes.
In more detail
React cannot see when such a store changes, so the store must notify subscribers and components must read it through useSyncExternalStore. Browser APIs such as the online status or a media query behave like external stores too.
Related terms
- useSyncExternalStore — The React hook for reading data from a store outside React, such as a state library or a browser API, without tearing.
- global state — Data kept where any part of a program can read and change it, such as a module-level variable or an app-wide store.
- Zustand — A small state management library for React that keeps state in an external store and lets components subscribe to just the parts they use.
Taught in
- Custom Hook Composition: Encapsulating Reactive Logic — React 19 & Modern Component Architecture
- useSyncExternalStore: Tearing-Free Store Subscriptions — React 19 & Modern Component Architecture