Reputation: 1765
I have this Immutable Map and I need to get to the property name
:
If I do retrospective.get('users')
I can get inside the users, but if I do retrospective.getIn(['users', 'name'])
It doesn't work... how can I access to the property name
?
Upvotes: 1
Views: 821
Reputation: 434
It does not work because users
is an array. So you have to provide an index like this
retrospective.getIn(['users', 0, 'name'])
Update:
To get all names
retrospective.get('users').map(user => user.get('name'))
Upvotes: 4