3 ms·
Which is indeed one of the points of Redux. The more of your app you can write as pure functions, the more of it is predictable and easily testable, so you don
by acemarke 7y ago
Which is indeed one of the points of Redux.
The more of your app you can write as pure functions, the more of it is predictable and easily testable, so you don't have to worry about how it's going to behave.
That's part of why we now specifically recommend writing as much of your logic as possible in reducers:
https://redux.js.org/style-guide/style-guide#put-as-much-logic-as-possible-in-reducers https://redux.js.org/style-guide/style-guide#put-as-much-log...
- hinkley 7y agoI think as long as the mutators are cohesive, the design is more coherent to the users. In a purely pigeonhole principle sense, more pure code crowds out impure. But if you can put all of the impure code into one or two phases of an interaction, you’re improving things without really changing the ratios at all. We often get sucked into analogs of the things we really need and I feel like this is one of them. You want the state changes to be comprehended. Fewer of them might help a lot or make things worse (legibility or performance). I believe it’s another quality over quantity situation.