The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Create a list with nested reduce functions in ImmutableJS

Create a list with nested reduce functions in ImmutableJS

1:30
ImmutableJS reduce functions can be nested to get data out of complex data structures. In this example, we will create an Immutable List from an Immutable Map that is nested inside of an Immutable List that is itself nested inside of an Immutable Map.
Watch this lesson now
Avatar
egghead.io

ImmutableJS reduce functions can be nested to get data out of complex data structures. In this example, we will create an Immutable List from an Immutable Map that is nested inside of an Immutable List that is itself nested inside of an Immutable Map.

Avatar
Bohdan Ganicky

Version with flatMap:

const names = cart.get('items').flatMap(item => item.get('personnel').map(person => person.get('name')))

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?