Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
Tearing is when different parts of the UI show different versions of the same external data during one render; useSyncExternalStore makes React read a consistent snapshot and re-render synchronously when the store changes.
With concurrent rendering, React can pause a render partway through. If components read a mutable external store directly, the store may change during the pause, so components rendered before and after the change show different values in the same committed UI. useSyncExternalStore(subscribe, getSnapshot) lets React detect such changes and re-render in a consistent way. getSnapshot must return a cached, immutable value that only changes when the data changes, otherwise React re-renders endlessly. State libraries such as Zustand and Redux use it internally; you need it directly when integrating browser APIs or custom stores.