参考文档:https://facebook.github.io/react/docs/update.html
react/lib/update 与 react-addons-update 等价
包含
$merge:合并对象
demo
var x = {
cards: [{
name: "a",id: 1
},{
name: "b",id: 2
},{
name: "c",id: 3
},{
name: "d",id: 4
}]
}
var z = update(x,{
cards: {
// 数组中的第三个
3:{ id:{
$apply: function(x) {return x * 2;}
}}
},});