- Mastering Immutable.js
- Adam Boduch
- 138字
- 2021-07-08 10:30:10
Chaining value insertion methods
When you need to insert more than one value into a collection, you have to call push() or set() multiple times. Instead of storing the new collection every time that you call the method, you can chain the method calls together. You can store the result of this chained call, which is the last collection. The other collections are called intermediary collections, which are freed the next time the garbage collector runs.
Immutable.js can copy collections efficiently because it only copies the parts of the collection that it absolutely needs to copy. When you make persistent changes, most of the old collection data is shared with the new collection. It can do this because most of the collection data hasn't changed, so it would be wasteful just to throw it to the garbage collector.
推薦閱讀
- Microsoft Dynamics 365 Extensions Cookbook
- AWS Serverless架構:使用AWS從傳統部署方式向Serverless架構遷移
- AngularJS Web Application Development Blueprints
- Android Application Development Cookbook(Second Edition)
- Learning ASP.NET Core 2.0
- 機器人Python青少年編程開發實例
- 微信小程序開發解析
- Learning FuelPHP for Effective PHP Development
- C語言程序設計實驗指導 (第2版)
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰
- 大學計算機基礎
- 深入分析GCC
- Python硬件編程實戰
- Getting Started with JUCE
- PHP從入門到精通(第7版)