【发布时间】:2017-01-05 12:02:48
【问题描述】:
我很难理解 immutablejs 的文档。我想更新名称为 Sanskar 的列表。为此,我首先尝试使用 findIndex 查找其索引并使用 update() 对其进行更新。但我收到 item.get() is not a function 的错误。
为什么我收到 item.get is not a function 的错误?
const arr = [
{name: 'Sanskar', age: 24, designation: 'Intern Developer'},
{name: 'John', age: 28, designation: 'Developer'}
];
const list1 = Immutable.List.of(arr);
const list2 = list1.findIndex(item => item.get('name') === 'Sanskar');
console.log('list2', list2.toJS());
我在jsbin中练习immutablejs
【问题讨论】:
标签: javascript ecmascript-6 immutable.js