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

Using the of() method

Collection types in Immutable.js have a static of() method. This method is an alternative to using the collection constructor. The one downside to using the constructor approach is that you have to pass in a JavaScript literal. You have to build and allocate memory for a structure that you're not actually using.

The of() method uses the arguments that are passed to it as the collection items.