React · Middle · Question 27 of 75

What is useSyncExternalStore for?

Explanation

The hook takes subscribe, getSnapshot and getServerSnapshot and guarantees a consistent value during concurrent rendering (no tearing). Redux, Zustand and similar libraries are built on it. Example: subscribing to navigator.onLine or localStorage.

Further reading

Problem with a question

React · Middle · question 27

Test yourself

Take the React · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz