DEV Community

Discussion on: Manage the state of your React app with Jotai

Collapse
 
dylanwatsonsoftware profile image
Dylan Watson • Edited

Yeah nice write-up! I've been playing with jotai lately and it seems really nice to use and has nice typescript integration. I also found it was better as type inference, so required less explicit types than zustand.

What's your thoughts about how best to carve up your application state? Would you expect many different atoms for individual primitives in your app? Or a single object that represents your whole state, as in redux and zustand?

Collapse
 
franciscomendes10866 profile image
Francisco Mendes

I like to use Jotai when I want to isolate the state into several small pieces. As mentioned, it is quite simple to observe and persist the state of our applications. It also has great integration with TypeScript.

One of the things I love is that it feels like such a natural extension to React because it's so similar to useState and because it's so simple to work with.

In the example of this article I didn't do justice to the modularity and flexibility of Jotai, but as I said at the beginning, I usually split my state into several different atoms.