State Management · Senior · Question 18 of 75

How do you react to Zustand changes outside React (e.g. sync to an analytics SDK)?

Explanation

subscribe returns an unsubscribe function. The subscribeWithSelector middleware lets you subscribe to a specific selector with an equality function - handy for side effects tied to one field.

Further reading

Problem with a question

State Management · Senior · question 18

Test yourself

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

Take this quiz