Questions tagged [immutable.js]

Immutable.js provides Persistent Immutable List, Stack, Map, OrderedMap, Set, OrderedSet and Record. They are highly efficient on modern JavaScript VMs (browser and nodejs) by using structural sharing via hash maps tries and vector tries as popularized by Clojure and Scala, minimizing the need to copy or cache data.

Immutable provides immutable data structures like List, Stack, Map, OrderedMap, Set and Record by using persistent hash maps tries and vector tries as popularized by Clojure and Scala. They achieve efficiency on modern JavaScript VMs by using structural sharing and minimizing the need to copy or cache data.

Immutable also provides a lazy Seq, allowing efficient chaining of collection methods like map and filter without creating intermediate representations. Create some Seq with Range and Repeat.

Getting started:

Install immutable using npm.

npm install immutable

Then require it into any module.

var Immutable = require('immutable');
var map = Immutable.Map({a:1, b:2, c:3});

Useful links:

License:

Immutable is BSD-licensed. We also provide an additional patent grant.

1177 questions
-1
votes
1 answer

immutable.js Map not persisting data

Using an immutable Map in a redux application Have the following in my reducer code: const IWT = new Map(); for (const item of action.IWT) { let current = IWT[item.index]; if (current) { current …
fox
  • 11,694
  • 20
  • 47
  • 76
-1
votes
2 answers

How can I update nested immutable in reducer?

I am pretty new for immutable.js. I want update home.filmList[0].isDetailModalShow = false. How can i do it? Please help me! My state like this: { home: { filmList: [ { id: 1, name: '111', imgUrl: '111', …
catwen
  • 1
  • 2
-1
votes
1 answer

Listening for ImmutableJS changes?

I want to trigger a function whenever a new ImmutableJS object is created. I want to use an ImmutableJS object as my React application state and I want to reduce boilerplate code. Here's part of what I have now: function addTodo(text) { let state…
Leo Jiang
  • 18,829
  • 38
  • 122
  • 215
-1
votes
1 answer

Redux-Router with immutable error

I'm trying to implement this example to get my boilerplate router/redux/immutable working: https://github.com/sjparsons/react-router-redux-immutable However I'm coming across an error I don't see documented elsewhere and I'm not sure where to go…
-1
votes
2 answers

How do I update an Immutable array in a React/Redux environment?

I have a React application that I'm using Redux to manage state. I have the reducer working correctly, and I've successfully, passed the action and data I need. The problem is, up to this point, I've only worked with strings, so I've been using the…
Tom Nolan
  • 1,658
  • 4
  • 24
  • 44
-1
votes
2 answers

filter value from json object

i have json object idAndNames.json; [ { "id":"1", "name":"name1"}, { "id":"2", "name":"name2"}, { "id":"3", "name":"name3"} ] i want to filter it by id and name function checkFilter(id,valueItem) { return id <= valueItem; } //i changed…
-2
votes
1 answer

Concat values of an immutable map in javascript

i'm having an immutable map like this: pinMap = Map({pin1: 1}, {pin2: 2}, {pin3: 3}, {pin4: 4}). Now i want to create an objct as follows: obj = {pinCode: 1234} whose value is the merged values of the map. I've tried the following command: const obj…
user7334203
  • 4,828
  • 15
  • 41
  • 89
1 2 3
78
79