- Mastering Immutable.js
- Adam Boduch
- 180字
- 2021-07-08 10:30:03
Collection methods return new data
Let's say that you have an Immutable.js collection: coll1. Then, you call a method to insert a new value into the collection: push('newValue'). This is what a persistent change looks like: coll1 persists and push() returns a new collection that includes the new value.
Not all collection methods are mutative. For example, if you want to filter a collection so that only items that pass a given criteria are returned, you would call the filter() method. This would result in a new collection, just like adding a new item would result in a new collection. The difference is that filter() isn't a persistent change—it's part of a sequence transformation.
Think of a sequence transformation as an Instagram filter. You have the original collection: the picture. Then, you have a filter() transformation, which takes the original picture data and rearranges some of the pixel data. You want to be able to see the results of the filter, but you don't want to change the original. The filter is just a view of the original.
- GeoServer Cookbook
- SQL學習指南(第3版)
- Spring Boot+Spring Cloud+Vue+Element項目實戰:手把手教你開發權限管理系統
- Responsive Web Design by Example
- 深入淺出PostgreSQL
- 軟件品質之完美管理:實戰經典
- Webpack實戰:入門、進階與調優
- 從零開始:UI圖標設計與制作(第3版)
- Image Processing with ImageJ
- IDA Pro權威指南(第2版)
- Practical GIS
- 多媒體技術及應用
- 從零開始:C語言快速入門教程
- Robot Framework Test Automation
- Java設計模式深入研究