Skip to content Skip to sidebar Skip to footer

Immutablejs How To Get A Value Inside An Object?

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'])

Solution 1:

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'))

Post a Comment for "Immutablejs How To Get A Value Inside An Object?"