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

  • Mastering Immutable.js
  • Adam Boduch
  • 176字
  • 2021-07-08 10:30:04

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.

主站蜘蛛池模板: 彭泽县| 晴隆县| 区。| 大英县| 遵义县| 托克托县| 高唐县| 海盐县| 本溪市| 岑巩县| 海兴县| 崇信县| 洞口县| 察哈| 衢州市| 鄂温| 叶城县| 图们市| 万源市| 彩票| 永登县| 大姚县| 沾化县| 军事| 名山县| 汉源县| 浮梁县| 高阳县| 临湘市| 宁蒗| 灵丘县| 苍梧县| 荥阳市| 犍为县| 藁城市| 海城市| 龙口市| 余庆县| 尤溪县| 霍邱县| 东辽县|