Mastering Immutable.js
上QQ阅读APP看书,第一时间看更新

Maps of values

You can use the of() method to create key-value maps:

const myMap = Map.of(
'a', 1,
'b', 2,
'c', 3
);
console.log('myMap', myMap.toJS());
// -> myMap { a: 1, b: 2, c: 3 }

The trick here is to alternate between the key and value arguments that are passed to of().