Loading tutorials
create, explains what create returns, and covers how set updates state. It also lists the mistakes people make with their first store.5 min readcreate. You will learn how a selector decides what a component reads and when it re-renders.4 min readcreate, as covered in the previous chapters.4 min readcreate and read it with selectors. Here you will learn exactly when a component re-renders, how selectors that return new objects break that, and how useShallow fixes it.4 min readset and how to read it with selectors. This chapter covers actions that wait for something, such as a network request, and the loading and error state that goes with them.4 min readcreate, read it with selectors, and update it with set. It also assumes you know TypeScript interfaces, generics, and utility types such as Partial.4 min readcreate, read it with selectors, and write actions with set. It also assumes you know what a module-level singleton is in JavaScript. A store from create is not locked inside React, and this chapter shows how to use that.5 min readcreate, update it with set, and type it with the create<T>()(...) form from earlier chapters. It explains what middleware is, how it composes, and what goes wrong when you stack it. The specific middleware (persist, devtools, immer) get th4 min readset. It also assumes you know what localStorage is. The previous chapter showed that middleware wraps the4 min readcreate, call set from actions, and wrap a store in middleware as covered in the previous chapters. You don't need Redux experience. You only need the browser extension, which Zustand talks to through a small middleware.4 min readcreate, selectors and set work in Zustand, and that you understand immutable updates (never changing an object in place, always building a new one). Here you will see why deeply nested state is awkward to update, and how the immer middleware fixes that.4 min readcreate, read it with selectors, and write actions with set. It also assumes you know the create<T>()(...) TypeScript form from the typing chapter. Middleware appears near the end, so it helps to have seen devtools and persist.4 min readcreate, read it with selectors, and write actions with set. This chapter covers the store underneath create, which has no React dependency. It also shows how to give each part of your component tree its own store instance.5 min readcreate lives at module level. That makes it easy to import, but it also means state carries over from one test to the next. This chapter shows how to reset a store between tests, test actions with and without React, and handle async actions and persist.4 min readcreate, read it with selectors, and update it with set. It covers the mistakes that cause extra renders, stale or lost state, and shared-state bugs. It ends with criteria for deciding when Zustand is the wrong tool.4 min read