Video wird geladen...
Video konnte nicht geladen werden
I made a state management library for React. It's called simple store. Goal: make Zustand way simpler ⭐ - Stores are like atom() in Jotai, so types are inferred - You can select nested values, and use *them* as stores too To understand that last point, watch to the... show more
79,936 Aufrufe • vor 11 Monaten •via X (Twitter)
35 Kommentare

I have a full breakdown on YouTube!

The source:

We don't need "simple" state manager. They already are simple, because it's just a reducer. Wtf is this trend from some developers to always search for "simple" solutions, when the world need expertise, robust and strong software ?

Really nice, would be great if getting deeply nested values didn’t require a chain of selects though but rather a way to use one select with an object or comma separated strings maybe

We're tracking an issue for this right now! If we support this, I believe we'll use Zustand's arrow function syntax as an alternative. Ex. select(store => store.deeply.nested.value)

Or use Solid with signals.

I really love your approach on this. thanks for building and sharing.

If I may, subscribe returning a tuple of current value and unsubscribe might save people a bit of effort

thank you for the tutorial @code_cowboy cc @kevfaveri

But why? Aren't there already a tons of state management solutions?

What happens if you have side effects, e.g., `meta: { contentLength: number }` which is the length of the `content` store value? Is there any way to handle those types of effects?

That sounds like derived values. I'd suggest generating those in your component instead of putting on the store directly. You can also hack it using subscribe: =>

Just walk over to Vue and use Pinia stores and all this subscribe complexity disappears. MVVM is so much simpler with right reactivity model.

I honestly don't get why people use zustand instead of jotai. some people just blindly follows other devs. you are using a library to write less code, not to write the same amounts of code. this is not a redux era.

this is nanostores

I like this work but if the selling point of this is being simple, then I think the only thing that really needs fixing in Zustand is type inference. Anything beyond that doesnt add simplicity, it just forces new patterns onto devs (which is fine, but i would nto call it "simple" anymore).

Does it have a website? That’s how I judge state management tools. Redux review is… designed with Bootstrap 4. Zustand, that one is good!

Looks neat, does it also support hydration for SSR much like Jotai?

That's nice

Valtio solved this… go check it out it’s goated

Nicely done sir 🫡

This looks great. > You can select nested values, and use *them* as stores too Sounds hot, how does that compare to jotai + optics? That said, we all know that Daishi has a monopoly on state management these days. He may come for you.

I like this kind of abstraction Just wondering if it's not possible to build it on top of Zustand? I remember some lens/optics plugins/middleware in the past

I just hash and put the entire client state in the URL params. What’s the issue

congrats on the launch

You've got my attention.

This is basically the latest XState Store (Zustand + Jotai)

Cool concept! Love the simplicity angle.

😍

Also something I think would be great DX that Zustand has, is updating parts of the store without needing to spread the store and would only update that specific part of store (keeping re renders optimized): const store = { foo: “bar”, bar: “baz” } store.set({bar: “z”})

Does your simple store support middleware like persistence or logging out of the box?

This is really neat. Feels pretty simple

How many levels deep we are on abstractions ?

This is dope!

what happened to lazyvim?🤣
