如果我这样做 retrospective.get('users')
我可以进入用户内部,但是如果我这样做 retrospective.getIn(['users', 'name'])
不起作用...我如何访问属性 name
?
最佳答案
它不起作用,因为users
是一个数组。所以你必须提供这样的索引
retrospective.getIn(['users', 0, 'name'])
更新:
获取所有名称
retrospective.get('users').map(user => user.get('name'))
关于javascript - ImmutableJS 如何获取对象内部的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48546697/