官术网_书友最值得收藏!

Chaining method calls

Immutable data doesn't just sit inside of a constant. Somehow, your applications need to make use of this data. These are called side-effects. A side-effect is something that is effected by immutable data, such as rendering data on the screen in a user interface or writing data to a file. By contrast, operations performed on immutable collections are either persistent changes or sequence transformations, both of which result in new collections. These operations don't have any side-effects; they just result in new data being created. Another term used for functions that don't cause side-effects is pure functions.

With Immutable.js, you start with a collection of immutable data and work your way toward some sort of side-effect. In functional programming, it's generally best to avoid side-effects due to the problems they cause. But side-effects are unavoidable. Without them, your software cannot interact with its environment. By chaining together Immutable.js collection methods, you can write clean and concise code that transforms immutable data into something that you need—something that a side-effect can use.

主站蜘蛛池模板: 微博| 朝阳市| 从化市| 额尔古纳市| 临湘市| 望城县| 额尔古纳市| 囊谦县| 汕尾市| 佳木斯市| 凉城县| 兴安县| 建水县| 金堂县| 修武县| 晋江市| 辽宁省| 弥渡县| 荔浦县| 朝阳区| 成都市| 湖南省| 宿迁市| 佛坪县| 寿宁县| 泾川县| 双鸭山市| 锡林郭勒盟| 永清县| 嘉鱼县| 清镇市| 沛县| 清镇市| 新干县| 贡觉县| 五寨县| 镇康县| 佛学| 芮城县| 漳浦县| 方正县|