Immutability in React

Originally published at:
In my previous article I wrote about the hows and whys of immutability. I argued that one area where immutability truly shines is in tracking changes, one of the big challenges in modern front-end frameworks. In this article I will give you an example of how immutability can be used with React, a library developed by Facebook.

This article won’t discuss the basic of React. If you need an introduction to this library, you can read the article Introduction to the React JavaScript Library.

How to use immutability in React

In my previous article, I implemented the core game logic for Minesweeper. In this article, we will take a look at the UI layer. There’s a couple of gotchas we need to account for when using immutable.js objects with React. The first one is that you cannot pass an immutable map or list directly to a React component like this:
Continue reading this article on SitePoint

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.