Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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

79,936 Aufrufe • vor 11 Monaten •via X (Twitter)

35 Kommentare

Profilbild von Ben Holmes
Ben Holmesvor 11 Monaten

I have a full breakdown on YouTube!

Profilbild von Ben Holmes
Ben Holmesvor 11 Monaten

The source:

Profilbild von Kevin Marques
Kevin Marquesvor 11 Monaten

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 ?

Profilbild von qwertea
qwerteavor 11 Monaten

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

Profilbild von Ben Holmes
Ben Holmesvor 11 Monaten

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)

Profilbild von Name cannot be blank
Name cannot be blankvor 11 Monaten

Or use Solid with signals.

Profilbild von zenith
zenithvor 11 Monaten

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

Profilbild von promethean
prometheanvor 11 Monaten

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

Profilbild von json™️
json™️vor 11 Monaten

thank you for the tutorial @code_cowboy cc @kevfaveri

Profilbild von Sp Loff
Sp Loffvor 11 Monaten

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

Profilbild von Paul van Dyk
Paul van Dykvor 11 Monaten

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?

Profilbild von Ben Holmes
Ben Holmesvor 11 Monaten

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

Profilbild von Tony OHagan
Tony OHaganvor 11 Monaten

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

Profilbild von Muhammad Mejanul Haque
Muhammad Mejanul Haquevor 11 Monaten

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.

Profilbild von Pavitra Golchha
Pavitra Golchhavor 11 Monaten

this is nanostores

Profilbild von Kerem Atam
Kerem Atamvor 11 Monaten

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

Profilbild von Eduardo Alvarez
Eduardo Alvarezvor 11 Monaten

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!

Profilbild von Niall O'Brien
Niall O'Brienvor 11 Monaten

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

Profilbild von Verious B. Smith III
Verious B. Smith IIIvor 11 Monaten

That's nice

Profilbild von Kirill Rodionov
Kirill Rodionovvor 11 Monaten

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

Profilbild von Stephen Burke
Stephen Burkevor 11 Monaten

Nicely done sir 🫡

Profilbild von Tom Firth
Tom Firthvor 11 Monaten

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.

Profilbild von Seb ⚛️ ThisWeekInReact.com
Seb ⚛️ ThisWeekInReact.comvor 11 Monaten

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

Profilbild von Carlos Rico-Ospina
Carlos Rico-Ospinavor 11 Monaten

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

Profilbild von Michael Magán
Michael Magánvor 11 Monaten

congrats on the launch

Profilbild von Asdrúbal Chirinos (Astro) 🚀
Asdrúbal Chirinos (Astro) 🚀vor 11 Monaten

You've got my attention.

Profilbild von David K 🎹
David K 🎹vor 11 Monaten

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

Profilbild von Webiny Enterprise CMS+ ⚡️
Webiny Enterprise CMS+ ⚡️vor 11 Monaten

Cool concept! Love the simplicity angle.

Profilbild von Sandrin Joy
Sandrin Joyvor 11 Monaten

😍

Profilbild von Matthew Volonnino
Matthew Volonninovor 11 Monaten

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”})

Profilbild von Karan Jagtiani
Karan Jagtianivor 11 Monaten

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

Profilbild von Omar Shoura
Omar Shouravor 11 Monaten

This is really neat. Feels pretty simple

Profilbild von Leszek
Leszekvor 11 Monaten

How many levels deep we are on abstractions ?

Profilbild von Jacob Kelley
Jacob Kelleyvor 11 Monaten

This is dope!

Profilbild von Robert 🟠
Robert 🟠vor 11 Monaten

what happened to lazyvim?🤣

Ähnliche Videos

Did you know if you tried to open a Trader Joe's, Grocery Outlet, or soon even a Mollie Stone's in San Francisco - you can't? That's because SF has a rule that formula retail chain stores that have more than 11 stores (worldwide!) can not open in commercial districts without a conditional use permit. With grocery stores and pharmacies closing across our city, these permits can delay opening new stores by 6-9 months - delaying much needed affordable food in our neighborhoods. So today I announced legislation to fix it. Going forward, any parcel already designated as a formula retail chain can convert to a grocery store or pharmacy without an additional conditional use permit. This will save them months on opening. For any new grocery store that opens, we will also allow them to include a bank, pharmacy, or restaurant without the need for another conditional use permit. As grocery stores consolidate and get smaller, this will help them occupy larger spaces while also bring more needed services to neighborhoods in need. And lastly, we will add grocery stores and pharmacies to the city's priority processing list. Importantly, this legislation isn't going to change the character of your neighborhood. It only regulates parcels that are already designated for formula retail chains. Because amidst an affordability crisis restricting access to food and medicine, we need to make it easier to open needed services. Not bury them in red tape. Thank you Supervisors Sherrill and Melgar for your early cosponsorship of our legislation. We will introduce it at the Board of Supervisors in the weeks ahead, and expect it to pass before the end of the year.

Bilal Mahmood 馬百樂

54,870 Aufrufe • vor 25 Tagen

Today I announced the Affordable Groceries Act to address our growing affordability crisis in San Francisco. For years, the price of milk, fresh vegetables, and more has been rising by double digits. At the same time, large chain corporations are leaving grocery stores and pharmacies as "zombie stores" - paying their lease to keep the storefronts vacant and block competition. The Affordable Groceries Act aims to end those food deserts by providing stimulus incentives to new grocery stores and pharmacies, while taxing zombie stores to generate revenue that could be used to fund new stores that sell affordable, fresh food. It works in 3 steps: 1. Streamline new stores, by eliminating conditional use permits for new groceries and pharmacies on vacant lots, while providing tax credits to reduce pharmacy gross receipts taxes. 2. Tax zombie stores, by ensuring that large chain corporations that deliberately leave grocery stores and pharmacies empty pay a vacancy tax for as long as they block competition from using the storefronts. The tax would not apply to small businesses, or to any new store that opens after January 2027. 3. Fund affordable groceries, by establishing an Affordable Grocery Fund that will subsidize operators that provide fresh affordable food. This could help corners stores convert into full grocery stores with fresh food, or let the city purchase buildings and rent them out to grocery operators who agree to keep prices low. We're bringing Affordable Groceries Act to the ballot this November, so you can make your voices heard that every San Franciscan deserves fresh affordable food in their neighborhood.

Bilal Mahmood 馬百樂

13,695 Aufrufe • vor 4 Monaten

Friedberg Predicts NYC’s Socialist Grocery Stores Will Be Wildly Popular and a DSA Marketing Tool for 2028 david friedberg: “I think that people have it wrong. I think these grocery stores are going to be wildly popular. I think that everyone's being a little bit too long-sighted in their view on what's going to happen with these grocery stores, with the basic obvious economic arithmetic that someone has to pay for this, and who's going to pay for it, and blah, blah, blah. I don't think it really matters because over the near term, what the cheap grocery stores do is create an incredible success story for socialism that will help to support and fuel the socialist wave in urban centers around this country. Think about the social network effect of the grocery store. So there's a couple of them, and then people start traveling from far away to the cheap grocery store because it has this discount. Again, this'll play out over the next 24 months, going into the 2028 election cycle, and everyone's like, ‘This is so wildly popular. People are coming in from all over the place to go to these grocery stores.’ They're not checking IDs, because IDs are racist, and you can't check IDs to vote, so we shouldn't be able to check IDs for grocery stores. So people will come in from all over the place to use these grocery stores. The demand will go up. And then they'll start to open more and more grocery stores like this. And let's say each one loses $10 million/year and they get to 10 or 20 of these. That's $200 million of losses/year on the grocery store chain. But it creates this extraordinary social movement for more of these grocery stores supporting the DSA and so on. $200 million/year on a $125 billion/year budget for the city of New York is nothing. It's less than a quarter of a percent of the city's budget. That is so cheap to market the DSA platform, and to get the DSA platform to become a social marketing element that drives the next wave here. So again, I do think that these grocery stores, believe it or not, they sound silly, they sound small, but I predict that they will be deemed a point of success, and they will end up being a big part of the fuel for the DSA going into 2028.”

The All-In Podcast

128,150 Aufrufe • vor 2 Monaten