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

  • Mastering Immutable.js
  • Adam Boduch
  • 179字
  • 2021-07-08 10:30:03

A collections API

A collection in JavaScript refers to anything that can be iterated over, for example, when using a for..of loop. In practice, this means arrays and objects. Arrays and objects are collections of values; the only difference between them is how you look up values. An array is an indexed collection, because you use a numerical index to lookup a value. An object is a keyed collection, because you use a key string to lookup a value.

The issue with these primitive JavaScript collection types is that they can change; that is, they're not immutable. The collections exposed by Immutable.js feel a lot like native arrays and objects. In fact, you can take an array or an object and use it to construct an Immutable.js collection. You can also turn an Immutable.js collection into a JavaScript array or object.

This is the extent of the Immutable.js API. You use collection classes to hold your immutable data. To use this immutable data, you call methods on these collections, which is at the very heart of the Immutable.js API.

主站蜘蛛池模板: 安阳县| 鄂伦春自治旗| 海原县| 稷山县| 甘泉县| 新田县| 金山区| 左权县| 江门市| 高邑县| 云阳县| 武邑县| 临高县| 航空| 罗定市| 沿河| 岳阳县| 石家庄市| 兴城市| 安仁县| 随州市| 汕头市| 自治县| 府谷县| 玉树县| 游戏| 龙门县| 湖南省| 宜城市| 清水县| 景泰县| 浦城县| 繁峙县| 都匀市| 汕头市| 襄垣县| 西昌市| 万载县| 乌兰察布市| 苍南县| 临漳县|