|
|
|
|
|
by svachalek
3742 days ago
|
|
I wouldn't say it's addressing these concerns so much as it agrees with some of the same solutions this article suggests (immutability, pure functions) and turns them into requirements. At least until you want asynchronous actions (and you will) in which case it seems to shrug and encourage using addons with side effects. The standard "react-redux" bindings make use of the presentation/container component pattern described here as well. |
|
I have simple action creators that are simple actions, where the reducers only update state... actions creators will do anything more complex...
I prefer the redux-thunks with async functions, as this lets me be more explicit and do a bit more work, if I need more status levels than loading/success/failure modes. This is a relatively simple example, and pretty close to how the defaults for redux-promise works...There's no side-effects to having your async calls inside your action creators... Well, there's a chance that an intermediate action may be dispatched in between the loading and success, but even then, unless things are very brittle, it's easy enough to mitigate, and that's only for portions of the tree that are shared.