4 ms·
Sounds like the solution you're begging at is to use something like bacon.js or csp inside of the flux actions.
by kaonashi 11y ago
Sounds like the solution you're begging at is to use something like bacon.js or csp inside of the flux actions.
- Mickydtron 11y agocsp is the first things that jumped into my head, as well. I wasn't familiar with bacon.js, it looks pretty interesting.
- natrius 11y agoAnd if you like CSP, you should consider going all the way to using core.async in ClojureScript. Channels are much more pleasant to use with syntax support.
- jlongster 11y agoNow you're making me want to implement this with the js-csp library to show it off. But you're exactly right. Redux (imho the best "flux" implementation out there, quotes because its only partly flux) is not against async abstractions like channels or observables. It just eschews requiring them as the backbone for communication with the UI, and favors a simple naive state change notification. But in action creators, if you need to do complex work, you should absolutely use channels or observables to synchronize stuff, and then dispatch simple actions to make state changes. I've found it really, really nice to constrain async abstractions into a single place. It makes the rest of the code just normal synchronous stuff (i.e. all the UI code, about 70% of our app), and you can do record/reply simply by just replaying actions.