Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

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 görüntüleme • 11 ay önce •via X (Twitter)

35 Yorum

Ben Holmes profil fotoğrafı
Ben Holmes11 ay önce

I have a full breakdown on YouTube!

Ben Holmes profil fotoğrafı
Ben Holmes11 ay önce

The source:

Kevin Marques profil fotoğrafı
Kevin Marques11 ay önce

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 ?

qwertea profil fotoğrafı
qwertea11 ay önce

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

Ben Holmes profil fotoğrafı
Ben Holmes11 ay önce

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)

Name cannot be blank profil fotoğrafı
Name cannot be blank11 ay önce

Or use Solid with signals.

zenith profil fotoğrafı
zenith11 ay önce

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

promethean profil fotoğrafı
promethean11 ay önce

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

json™️ profil fotoğrafı
json™️11 ay önce

thank you for the tutorial @code_cowboy cc @kevfaveri

Sp Loff profil fotoğrafı
Sp Loff11 ay önce

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

Paul van Dyk profil fotoğrafı
Paul van Dyk11 ay önce

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?

Ben Holmes profil fotoğrafı
Ben Holmes11 ay önce

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

Tony OHagan profil fotoğrafı
Tony OHagan11 ay önce

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

Muhammad Mejanul Haque profil fotoğrafı
Muhammad Mejanul Haque11 ay önce

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.

Pavitra Golchha profil fotoğrafı
Pavitra Golchha11 ay önce

this is nanostores

Kerem Atam profil fotoğrafı
Kerem Atam11 ay önce

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

Eduardo Alvarez profil fotoğrafı
Eduardo Alvarez11 ay önce

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 profil fotoğrafı
Niall O'Brien11 ay önce

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

Verious B. Smith III profil fotoğrafı
Verious B. Smith III11 ay önce

That's nice

Kirill Rodionov profil fotoğrafı
Kirill Rodionov11 ay önce

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

Stephen Burke profil fotoğrafı
Stephen Burke11 ay önce

Nicely done sir 🫡

Tom Firth profil fotoğrafı
Tom Firth11 ay önce

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.

Seb ⚛️ ThisWeekInReact.com profil fotoğrafı
Seb ⚛️ ThisWeekInReact.com11 ay önce

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

Carlos Rico-Ospina profil fotoğrafı
Carlos Rico-Ospina11 ay önce

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

Michael Magán profil fotoğrafı
Michael Magán11 ay önce

congrats on the launch

Asdrúbal Chirinos (Astro) 🚀 profil fotoğrafı
Asdrúbal Chirinos (Astro) 🚀11 ay önce

You've got my attention.

David K 🎹 profil fotoğrafı
David K 🎹11 ay önce

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

Webiny Enterprise CMS+ ⚡️ profil fotoğrafı
Webiny Enterprise CMS+ ⚡️11 ay önce

Cool concept! Love the simplicity angle.

Sandrin Joy profil fotoğrafı
Sandrin Joy11 ay önce

😍

Matthew Volonnino profil fotoğrafı
Matthew Volonnino11 ay önce

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

Karan Jagtiani profil fotoğrafı
Karan Jagtiani11 ay önce

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

Omar Shoura profil fotoğrafı
Omar Shoura11 ay önce

This is really neat. Feels pretty simple

Leszek profil fotoğrafı
Leszek11 ay önce

How many levels deep we are on abstractions ?

Jacob Kelley profil fotoğrafı
Jacob Kelley11 ay önce

This is dope!

Robert 🟠 profil fotoğrafı
Robert 🟠11 ay önce

what happened to lazyvim?🤣

Benzer Videolar

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,921 görüntüleme • 1 ay önce

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 görüntüleme • 4 ay önce

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 görüntüleme • 3 ay önce