[英]How to access value in immutable object/map in JS?
我正在尝试获取“消息”值,但是当我使用它时它返回未定义:
console.log('message: ', props.information.getIn(['_root', 'entries']))
为了控制台记录下面的数据,我使用这个“console.log(props.information)”
size: 4
__altered: false
__hash: undefined
__ownerID: undefined
_root: ArrayMapNode
entries: Array(4)
0: (2) ['Name', 'Update']
1: (2) ['title', 'Update']
2: (2) ['message', 'Click here to learn about......']
3: (2) ['clickURL', 'www.google.com']
length: 4
[[Prototype]]: Array(0)
我检查了另一个类似的帖子,但我不明白。 从 map 数据结构中获取价值这个问题最相似,但我已经尝试了他们所做的: 'props.information.get('_root').get('entries')' doesn't work for me
你需要做的是:
console.log('message: ', props.information.getIn(['entries']));
所以这就是最终为我工作的
props.Information.get('message')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.