QuizNot attempted
Why useSyncExternalStore exists
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Yes —
useSyncExternalStoreis specifically designed to safely subscribe to external mutable stores and re-render on notification
useSyncExternalStoresubscribes viastore.subscribe- when
increment()notifies listeners, React re-readsgetSnapshot(), sees a new value and re-renders, wherever the mutation came from, consistently under concurrent rendering. - Not 'invisible to React': the subscription is what makes it visible.
- Not 'only after an unrelated re-render': the listener schedules the update itself.
- Not 'React 19 only': the hook shipped in React 18 (with a shim for older versions).