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

  • Mastering Immutable.js
  • Adam Boduch
  • 75字
  • 2021-07-08 10:30:11

Updating map values

Let's revisit the earlier example where we called update() on a list. Inside of the update function, increment(), we used set() to change the value of map. Map was the list value that we were updating. Let's make map use the update() method as well:

const increment = map => map.update(
'total',
t => t + map.get('step')
);

Instead of having to call map.get('total'), total is passed in as the function argument.

主站蜘蛛池模板: 土默特左旗| 金塔县| 利辛县| 芜湖市| 金寨县| 保山市| 潮州市| 江达县| 东乌珠穆沁旗| 广州市| 开远市| 北票市| 桦甸市| 枝江市| 乌兰县| 和硕县| 建宁县| 伽师县| 天水市| 宁城县| 虎林市| 上思县| 寿宁县| 拜泉县| 肇州县| 舞阳县| 湘乡市| 昆明市| 镇平县| 罗田县| 扶余县| 富平县| 林芝县| 遵义县| 翼城县| 阳山县| 静乐县| 延庆县| 山丹县| 岱山县| 河西区|