immutable List操作

Awbeci
  • 2.4k
import { Map, fromJS, merge, List } from "immutable";

const data = fromJS({
    users: [{
        name: 'zhangsan',
        age: 18,
        friends:[{
            name: 'liuliu',
            age: 16
        },{
            name: 'lilei',
            age: 17
        }]
    },{
        name: 'lisi',
        age: 20,
        friends:[{
            name: 'hmm',
            age: 28
        }]
    },{
        name: 'wangwu',
        age: 33,
        friends:[{
            name: 'sam',
            age: 35
        }]
    }]
})

我现在想在users里面name=zhangsan的friends再添加 一个{name:'xiaoming',age: 12},我该如何写?

评论
阅读 629
撰写回答

登录后参与交流、获取后续更新提醒

宣传栏