useSyncExternalStore Hook
The sanctioned way to read a store that lives outside React (Redux-style stores, browser APIs like matchMedia): subscribe + getSnapshot let React re-check the value at precise points so all components see one consistent snapshot during a concurrent render, eliminating tearing. It also takes getServerSnapshot for hydration-safe server rendering.
This Concept is waiting for its first lesson!
The sanctioned way to read a store that lives outside React (Redux-style stores, browser APIs like matchMedia): subscribe + getSnapshot let React re-check the value at precise points so all components see one consistent snapshot during a concurrent render, eliminating tearing. It also takes getServerSnapshot for hydration-safe server rendering.
Are you a teacher? Sign in to start contributing.
Sign In