Загрузка видео...

Не удалось загрузить видео

На главную

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 просмотров • 11 месяцев назад •via X (Twitter)

Комментарии: 35

Фото профиля Ben Holmes
Ben Holmes11 месяцев назад

I have a full breakdown on YouTube!

Фото профиля Ben Holmes
Ben Holmes11 месяцев назад

The source:

Фото профиля Kevin Marques
Kevin Marques11 месяцев назад

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
qwertea11 месяцев назад

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
Ben Holmes11 месяцев назад

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
Name cannot be blank11 месяцев назад

Or use Solid with signals.

Фото профиля zenith
zenith11 месяцев назад

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

Фото профиля promethean
promethean11 месяцев назад

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

Фото профиля json™️
json™️11 месяцев назад

thank you for the tutorial @code_cowboy cc @kevfaveri

Фото профиля Sp Loff
Sp Loff11 месяцев назад

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

Фото профиля Paul van Dyk
Paul van Dyk11 месяцев назад

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
Ben Holmes11 месяцев назад

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
Tony OHagan11 месяцев назад

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
Muhammad Mejanul Haque11 месяцев назад

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
Pavitra Golchha11 месяцев назад

this is nanostores

Фото профиля Kerem Atam
Kerem Atam11 месяцев назад

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
Eduardo Alvarez11 месяцев назад

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
Niall O'Brien11 месяцев назад

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

Фото профиля Verious B. Smith III
Verious B. Smith III11 месяцев назад

That's nice

Фото профиля Kirill Rodionov
Kirill Rodionov11 месяцев назад

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

Фото профиля Stephen Burke
Stephen Burke11 месяцев назад

Nicely done sir 🫡

Фото профиля Tom Firth
Tom Firth11 месяцев назад

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
Seb ⚛️ ThisWeekInReact.com11 месяцев назад

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
Carlos Rico-Ospina11 месяцев назад

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

Фото профиля Michael Magán
Michael Magán11 месяцев назад

congrats on the launch

Фото профиля Asdrúbal Chirinos (Astro) 🚀
Asdrúbal Chirinos (Astro) 🚀11 месяцев назад

You've got my attention.

Фото профиля David K 🎹
David K 🎹11 месяцев назад

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

Фото профиля Webiny Enterprise CMS+ ⚡️
Webiny Enterprise CMS+ ⚡️11 месяцев назад

Cool concept! Love the simplicity angle.

Фото профиля Sandrin Joy
Sandrin Joy11 месяцев назад

😍

Фото профиля Matthew Volonnino
Matthew Volonnino11 месяцев назад

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
Karan Jagtiani11 месяцев назад

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

Фото профиля Omar Shoura
Omar Shoura11 месяцев назад

This is really neat. Feels pretty simple

Фото профиля Leszek
Leszek11 месяцев назад

How many levels deep we are on abstractions ?

Фото профиля Jacob Kelley
Jacob Kelley11 месяцев назад

This is dope!

Фото профиля Robert 🟠
Robert 🟠11 месяцев назад

what happened to lazyvim?🤣

Похожие видео

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 просмотров • 1 месяц назад

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 просмотров • 4 месяцев назад

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 просмотров • 3 месяцев назад