Using Immutable.js

The Immutable.js library from Facebook provides immutable JavaScript data structures. This might sound trivial but there's a lot that goes on behind the scenes to make this work, namely creating new instances from transformations as efficiently as possible.

In this section, we'll look at immutable lists and maps. These are viable substitutes for arrays and plain objects, respectively, in our Flux store data. Then, we'll look at how Immutable.js can compose complex transformations without the need for intermediary representations. Finally, we'll see how Immutable.js returns the same instance when there's no mutations after running through a transformation, allowing for efficient change detection.

Immutable lists and maps

We'll start ...

Get Flux Architecture now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.