Development History of Zustand

Rate this content
Bookmark

In this talk, I will talk about how I joined the development of Zustand. It started with another library of mine, which is similar to Zustand. My involvement was from Zustand v3 and it's currently v4. Philosophy of Zustand is being small, and we improve it with keeping the philosophy. Finally, we compare Zustand with Jotai, which is another state management library that I develop.

FAQ

Zestand is a state management library for React that focuses on providing a minimal API and small bundle size. Its primary purpose is to manage global state in React applications, following Flux principles and providing a less opinionated, yet extensible, approach.

Zestand was initially released in April 2019 and has been developed by a team including Daishi Kato, who joined the development team in August 2020 to enhance its features, particularly for concurrent rendering in future versions of React.

Zestand is unique because it does not use React context for state propagation, which is common in many other state management libraries. This approach avoids the complexity and overhead associated with context providers, especially in applications where global state is defined at the module level.

The latest version of Zestand, V4, incorporates the useSyncExternalStore hook from React 18, improving concurrent rendering capabilities. It also features enhanced TypeScript types and has undergone significant codebase revisions for better performance and usability.

Contributors can get involved by improving documentation, adding tests, enhancing existing middleware, and developing third-party libraries to expand the Zestand ecosystem. The project is particularly open to contributions that enhance developer experience and documentation.

Future plans for Zestand include dropping support for React 17 and removing the useSyncExternalStore shim to streamline the library in line with newer React versions. The focus will remain on improving existing features rather than adding new ones, with a strong emphasis on concurrency support and stability.

Zestand and Jotai differ primarily in their state management models. Zestand uses a store with actions and selectors to manage state, whereas Jotai uses a more React-oriented approach with atoms that represent pieces of state and can be combined or derived. Jotai aims to avoid the need for selectors by using dependency tracking to optimize re-renders.

Daishi Kato
Daishi Kato
19 min
06 Jun, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This talk provides an overview of the development history of Zestand, a state management library for React, and the speaker's involvement in it. It also introduces Jotai, another state management library developed by the speaker, and compares it with Zestand. The talk highlights the unique features and goals of both libraries, as well as the challenges of monetizing open-source software.

Available in Español: Historia de Desarrollo de Zustand

1. Introduction to Zestand

Short description:

This talk is about the development history of Zestand and my involvement in it. Zestand is a state management library for React. I'm Daishi Kato, a freelancer who likes programming and open source software. Zestand is one of my successful projects. It got attention and became popular. React hooks inspired me to develop various libraries, including Zestand.

Hello, this talk is about the development history of Zestand and how I was involved in it. By the way, I pronounced it Zestand, but how we should pronounce it is not defined. We can call it as we like.

For those who don't know, Zestand is a state management library for React.

To begin with, let me introduce myself. I'm Daishi Kato. I'm a freelancer who likes programming, and especially open source software. There are lots of open source work I have done. Mostly started as experiments. Some of them got attention and become fairly known projects. Zestand is the library we talked today. Jyotai is another state management library which I gave a talk previously. Valusio is yet another library. All those three are developed with a team called Poimanderes. That last one is called Reactract, which is one of my big projects exploring React hooks. There are many other small libraries. Most of my recent work is with React hooks. But I have a broader interest in JavaScript in general.

Anyway, today's talk is about Zestand. Zestand is one of the successful projects. It's a state management library, and there are so many such libraries out there. Because there are so many, letting people know and getting popular is a huge challenge. Luckily, Zestand got some attention by now. It's just lucky, I suppose. I wasn't involved in the original development of Zestand, but I was doing something very similar back in the days. It was back in 2018. React announced the hooks at React Conf 2018 October. It was a great inspiration and I developed various libraries with hooks, some of which have been for state management. Before hooks, I had developed a library with React context, just like others did. I took the same approach and created a hooks version of it.

2. Development and Maintenance of Zastand

Short description:

While developing Zastand, I realized it didn't need React context for global state. I released the initial version in April 2019, and it gained some users. Zastand stood out for not using React context, unlike other global state libraries. I joined the team in August 2020 to make Zastand more concurrent rendering friendly. After version 2, Zastand wasn't maintained, so I took over and released version 3 with improvements.

While I was developing it, I knew it doesn't require React context because the use case is global state. Users will never have nested provider components. I actually made a version without context but it wasn't welcomed by users at the moment. And time passed.

It was April 2019 when the initial version of Zastand is released. It was still rough but got some users. With some collaborators, version 1 was released in June. Soon afterwards, I found it from somewhere. At that point, I had a tool, a repository, which is to compare various global state libraries. It was built to check the behavior of concurrent rendering. The tool was used for checking my libraries and some other popular libraries. So I added Zastand there too. Zastand was unique as it didn't use React context at all. All others used context for state propagation or scoping stores. I think React context has been overused for global state. Unless you use context providers multiple times in your component tree, it's not contextual. Global state defined at module level should just work. Zastand was a pioneer in this approach. I'm convinced with it and re-implemented one of my libraries. Later, I wrote a detailed blog post about it. Anyway, that's how I met Zastand. As I said, one of my repositories to compare various global states in concurrent rendering.

I was interested in making Zastand more concurrent rendering friendly for future React. I joined the team on August 2020 and took the development of Zastand. Zastand had been developed actively in the previous year and reached version 2. However, it wasn't actually maintained after that. There were a certain amount of users and few issues opened, but nobody was taking care of them. While my motivation was concurrent rendering, I started to maintain it and resolve those issues. v3 was released on the same month I started working on it. It had two big improvements, but other than that, it's basically compatible with the previous version.