Why Immutable Js?

What is this article about?

In my previous post of “Why Redux?” we get to know why any state manager is necessary for large web apps, similar to that it is also equally important to use Immutable data structure if we are using a state manager, Why? We’ll learn that here.

First we need to know what is mutable and what is immutable before learning why to use Immutable js, Immutable objects (data structure)  are simply objects whose state (the objects data) cannot change after construction. Mutable objects (data structure)  have fields that can be changed, immutable objects have no fields that can be changed after the object is created.

Some most of the programming languages comes with both type of data structure but that isn’t the case with Javascript, Why it is needed? Because when we are using common state store as with redux or through any other state manager, as our state store is subscribed by multiple components and in those component we do some modification as for the requirement of that component, our state in store also gets modified which might create some malfunction in working of other components because the state is modified by first component and now our other component isn’t receiving the original state but modified state!

To avoid above scenario developers comes up with Immutable JS to our rescue which makes JavaScript object immutable, You can read more about it and how to use it in ouon its official documentation.

Posted in

JavascriptReactTechnologyWeb Development

Submitted by


Why trying to master digital Marketing, when LeadMirror with A2i can help you get there with ease?

Join Lead Mirror Today

Setting up your account takes less than a minute.