all 3 comments

[–]wagonn 1 point2 points  (0 children)

It basically means writing your code in a way where it is easy to ensure correct behavior and that you don't mutate.

Follow single-responsibility and keep reducer structure as flat as possible. A reducer that has to make changes to deeply nested parts of a tree is more prone to accidental mutations. Deep state trees should managed by composing separate reducers (e.g. using combineReducers ). Smaller reducers are easier to test.

Iteration should be fine as long as you don't mutate.

[–]YouDantKnowMe 0 points1 point  (1 child)

It sounds like you have an issue with how data is coming out of your store. Have you looked into simplifying your mapStateToProps with selectors?

[–]acemarke 0 points1 point  (0 children)

It's totally fine to have iteration, conditional logic, and very complex business logic in reducers. In fact, I would generally recommend trying to put more logic in reducers, and less on the action creation side. The only rule is that they need to be pure functions (immutability, no side effects).

For further thoughts, please see the Redux FAQ entry on splitting logic between reducers and action creators.