我想圖如下圖所示:如何合併immutable.js中的地圖?
Map{
"status":1,
"user":{
"name":"more",
"age":8,
"id":1
}
}
我完整的代碼:
import {fromJS} from 'immutable'
let b={
"user":{
name:"more11",
age:8
},
"status":1
}
let d={
"id":1,
"name":"more",
"age":19
}
let d1=fromJS(d)
let b2=fromJS(b)
Const map2=b1.get('user).mergeDeepIn(d1)
console.log(map2.getIn(['user','name']));
console.log(map2.getIn(['user','age']));
原始代碼image
對不起,我是新來的stackoverflow和不可變的 – Moretai
請將您的代碼作爲文本發佈。代碼的圖像相對無用,對某些人來說無法訪問。 – 4castle
hello.for例如。讓map1 = Map({a:1,b:{c:2,d:3,e:1});讓map2 = Map({c:100,d:400});如何獲得地圖{a:1,b:{c:100,d:400,e:1}} – Moretai