Summary
In this chapter, we learned about the Zustand library. It's a tiny library that uses module state in React. We looked at a counting example and a Todo example to grasp how to use the library. We typically use this library to understand object referential equality. You can choose this library or similar approaches based on your requirements and what you have learned in this chapter.
We didn't discuss some aspects of Zustand in this chapter, including middleware, which allows you to give some features to the store
creator, and non-module state usage, which creates a store
in the React life cycle. These can be other considerations when you're choosing a library. You should always refer to the library documentation for more – and the latest – information.
In the next chapter, we will learn about another library, Jotai.