Skip navigation
I made a state management library for React. It's called simple store.
0:00 / 4:54

I made a state management library for React. It's called simple store.

Ben Holmes

@BHolmesDev51K followers

Visit on X
1,069 likesDownloadOriginal post

79,989 views

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 end! 👀

35 Comments

Comments from the original post on X (Twitter)

  • Ben Holmes's profile picture

    @BHolmesDev

    I have a full breakdown on YouTube!

    22 likes

  • Ben Holmes's profile picture

    @BHolmesDev

    The source:

    8 likes

  • Kevin Marques's profile picture

    @KM_Marques

    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 ?

    16 likes

  • qwertea's profile picture

    @amanat361

    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

    6 likes

  • Ben Holmes's profile picture

    @BHolmesDev

    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)

    12 likes

  • Name cannot be blank's profile picture

    @IsNotBlank

    Or use Solid with signals.

    6 likes

  • zenith's profile picture

    @bossadizenith

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

    2 likes

  • promethean's profile picture

    @quantizor

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

    2 likes

  • json™️'s profile picture

    @jsontsx

    thank you for the tutorial @code_cowboy cc @kevfaveri

    1 like

  • Sp Loff's profile picture

    @x_sp_x

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

    1 like

  • Paul van Dyk's profile picture

    @nemuksis

    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?

    1 like

  • Ben Holmes's profile picture

    @BHolmesDev

    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: =>

    1 like

  • Tony OHagan's profile picture

    @tony_ohagan

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

    1 like

  • Muhammad Mejanul Haque's profile picture

    @mejanul_haque

    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.

    1 like

  • Pavitra Golchha's profile picture

    @PavitraGolchha

    this is nanostores

    1 like

  • Kerem Atam's profile picture

    @kerematam

    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).

    1 like

  • Eduardo Alvarez's profile picture

    @el_alien

    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!

  • Niall O'Brien's profile picture

    @niall_obrien

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

  • Verious B. Smith III's profile picture

    @verioussmith

    That's nice

  • Kirill Rodionov's profile picture

    @kirillrod_

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