I\'m trying to use ImmutableJS with my React / Flux application.
My stores are Immutable.Map
objects.
I\'m wondering at which point should I use
Like @LeeByron said, you shouldn't have to call a toJS
. Under React 0.14.*, calling map
on an Immutable Map
will work and render correctly, but you will end-up with a warning:
Using Maps as children is not yet fully supported. It is an experimental feature that might be removed. Convert it to a sequence / iterable of keyed ReactElements instead.
To deal with this, you can call toArray()
on your Map
like:
render () {
return (
{this.props.immutableMap.toArray().map(item => {
{item.title}
})}
)
}
Converting your iterable to an array and giving React what it wants.