Re:Show HN: SimpleR State – simple state management for React
by brainless on Monday March 22, 2021 @06:51AM
(#26539079)
I really like what you have done here. I have two questions:
1. Do you mind sharing examples with async calls? This is very common and I really look for this example as quick as possible
2. How you do connect two stores? Say one triggers and update in the other...
Thanks a lot :)
Re:Show HN: SimpleR State – simple state management for React
by aenero on Monday March 22, 2021 @08:25AM
(#26539824)
You'd be happy to know those are supported and documented at https://simpler-state.js.org
Specifically, look at these "Recipes" pages:
Re:Show HN: SimpleR State – simple state management for React
by xixixao on Monday March 22, 2021 @11:12AM
(#26541958)
It’s not clear how to define a new entity out of another one using a selector. So perhaps instead of/in addition to `x.use(foo)` you might want `x.select(foo).use()`.
Not sure if simpler but something I’d be missing/would feel inconsistent.
Re:Show HN: SimpleR State – simple state management for React
by aenero on Monday March 22, 2021 @04:24PM
(#26546411)
Hi. SimpleR State makes use of selectors without creating a new entity (unlike atoms in Recoil, for example). It uses the more classic paradigm used by popular libs like React Redux where you just use selectors to filter/transform the "received" state to the format required by the component, and not to "create" a derived state per se. I hope it makes sense.
Re:Show HN: SimpleR State – simple state management for React
by christophilus on Monday March 22, 2021 @07:21AM
(#26539316)
Looks kind of similar to something Mithril does (or used to do). Ergonomically, I prefer `counter(0)` to `counter.set(0)`.
I wrote this library with the hope that this might be it. Any ideas/suggestions how to further simplify it would be super!