State Management · Middle · Question 22 of 75

How do you read or update a Zustand store outside React components (e.g. in an API helper)?

Explanation

The hook returned by create also carries the vanilla store API: getState, setState, subscribe. Handy for interceptors, websockets and tests.

Further reading

Problem with a question

State Management · Middle · question 22

Test yourself

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

Take this quiz