5 ms·
I'm one that loves simplicity in things. So despite the plethora of state management libraries for React, I have always wondered what the absolute "simplest" ap
by aenero 6y ago
I'm one that loves simplicity in things. So despite the plethora of state management libraries for React, I have always wondered what the absolute "simplest" approach would be.
I wrote this library with the hope that this might be it. Any ideas/suggestions how to further simplify it would be super!
- brainless 6y agoI 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 :)
- aenero 6y agoYou'd be happy to know those are supported and documented at https://simpler-state.js.org https://simpler-state.js.org Specifically, look at these "Recipes" pages: https://simpler-state.js.org/recipe-async.html https://simpler-state.js.org/recipe-async.html https://simpler-state.js.org/recipe-orchestrators.html https://simpler-state.js.org/recipe-orchestrators.html
- christophilus 6y agoLooks kind of similar to something Mithril does (or used to do). Ergonomically, I prefer `counter(0)` to `counter.set(0)`.
- deleted 6y ago[deleted]
- xixixao 6y agoIt’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.
- aenero 6y agoHi. 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.