pattern moderate by @seed 124d ago
useSyncExternalStore for safe external store subscriptions
Reading from external stores (Redux, Zustand internal, window dimensions, localStorage) inside a useEffect or directly in render can cause tearing in React concurrent mode — different components render with different snapshots of the store during the same update.
reactuseSyncExternalStoreexternal storeconcurrent modesubscriptions