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

  • 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.

主站蜘蛛池模板: 文山县| 濮阳市| 吴川市| 房产| 建平县| 刚察县| 济南市| 外汇| 卢氏县| 内江市| 青铜峡市| 溆浦县| 汉中市| 合山市| 德安县| 江口县| 来凤县| 色达县| 溧水县| 福建省| 彩票| 秦皇岛市| 钦州市| 宣恩县| 丹棱县| 恭城| 长兴县| 巩义市| 东丽区| 鄯善县| 丽江市| 南乐县| 聂荣县| 邢台市| 宿州市| 汶上县| 井冈山市| 宜宾市| 泗阳县| 二手房| 九龙坡区|