Flattening collections
Collections in Immutable.js can have simple values, or they can have complex values such as other collections. These collections can in turn contain other collections, and so on. These deep structures are necessary to reflect the model of your application data. However, traversing nested hierarchies is error prone.
Avoiding recursion
When you're dealing with hierarchical data, recursion is inevitable. We write a function that calls itself when a new level in the hierarchy is discovered. This is difficult to do because these types of functions often end up being highly specialized, applying to only one situation. With Immutable.js and its persistent-change/transformation/side-effect pattern, writing recursive functions is often a dead end.
When traversing nested collections, you don't often care where you are in the hierarchy. So, if all you need is to locate a particular value, it's much simpler to traverse a flat collection.
Note
The downside to flattening collections...