Chapter 7: Use Case Scenario 1 – Zustand
So far, we have been exploring some basic patterns we can use to implement a global state in React. In this chapter, we will learn about a real implementation that is publicly available as a package, called Zustand.
Zustand (https://github.com/pmndrs/zustand) is a tiny library primarily designed to create module state for React. It's based on an immutable update model, in which state objects can't be modified but always have to be newly created. Render optimization is done manually using selectors. It has a straightforward and yet powerful store creator interface.
In this chapter, we will explore how module state and subscriptions are used and see what the library API looks like.
In this chapter, we will ...
Get Micro State Management with React Hooks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.