[英]Avoid ImmutableJS Map converting arrays to List
Curently if I have m.set(someArray)
where m is a Map
, it will try to convert someArray
to Immutable List
. 当前,如果我有
m.set(someArray)
,其中m是Map
,它将尝试将someArray
转换为Immutable List
。 How do I disable this behaviour? 如何禁用此行为?
Pass a copy of the array, instead: 传递数组的副本,而不是:
m.set(someArray.slice());
Note that, if the array contains reference values (objects, arrays), the references are copied. 请注意,如果数组包含参考值(对象,数组),则将复制参考。
.slice()
is only a shallow copy. .slice()
只是一个浅表副本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.