Better Programming

Advice for programmers.

Follow publication

Member-only story

3 Reasons to Avoid Using ImmutableJS With Redux

Chris Vibert
Better Programming
Published in
6 min readJan 2, 2020

Redux wouldn’t work without immutable data, and so it makes sense the immutable-js library — which helps to ensure immutability — has become used so frequently with Redux. But after working with ImmutableJS in a few large-scale React-Redux applications, it’s clear using the library comes at a price, and that once in, it’s difficult to opt out.

The three reasons to avoid using ImmutableJS with Redux are:

  1. It leaks into dumb components, making them impure and difficult to work with
  2. It can kill Redux performance
  3. It allows the application state to become complex and deeply nested

Before diving into these, here’s a brief run through of what immutability is, why it’s so important in Redux, and what ImmutableJS offers.

Immutability and Redux

Redux decides if a component should rerender by checking if any piece of the application’s state relevant to that component has changed.

When the application’s state is an immutable object — meaning that once created it can’t then be changed, or mutated — Redux can make this check very quickly and easily.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Write a response