What is the equivalent to Object.entries()
in Immutablejs Map. Basically, I enumerate the object's key/value pairs to render a presentational component
{
Object.entries(filteredNetworks)
.map(([key, value]) =><option key={key} value={key}>{value}</option>)
}
Now, with the filteredNetworks
being an immutable Map, how can i do the same ? (without using .toJS()
)
Based on: https://facebook.github.io/immutable-js/docs/#/Iterable/map
{
filteredNetworks.map(
(value, key) => <option key={key} value={key}>{value}</option>
)
}
note that argument order changed for the mapper function.
Another option using Entry Sequence could be
{
filteredNetworks.entrySeq().map(
.map(([key, value]) =><option key={key} value={key}>{value}</option>)
)
}
fiddling around at https://jsfiddle.net/3r866to3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With