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.

1206 questions
0
votes
2 answers

ReactJS controlled component and immutable data

I wonder how controlled components (e.g an input box) can be implemented, if the data of an app is build upon immutable data and the app uses "===" equality operators in shouldComponentUpdate() for fast re-rendering. Let's assume deeply nested data…
JoeFrizz
  • 611
  • 1
  • 9
  • 18
-1
votes
1 answer

Question on Best practices: Immutability and re-rendering with React Native

I have created an immutable map and am currently using it with redux and i have some general questions about immutability. From what I understand, when passing props down to a component the props do an initial render. If the value of the prop is…
-1
votes
1 answer

How to delete nested element in map Immutable.js

I have the following structure in my redux case: initialState: SearchState = fromJS({ isFiltersPanelOpen: false, sections: { type: { Course: { isSelected: false, filterValues: 42, }, Path: { …
-1
votes
1 answer

Inserting Item to Immutable List Attached to Grid Not working

I'm trying to insert a dummy value to an Immutable list which is attached to a Grid.But nothing is showing up when i inspect private filterdSchoolSelectionData: Immutable.List = Immutable.List([]); let emptydata:…
techno
  • 6,100
  • 16
  • 86
  • 192
-1
votes
1 answer

studying immutable and can't understand what they say

I'm studying about record of immutable.js. but this code almost kill me. My Question I know [import, export,const] but [type] is what mean. defaultValues:, makePoint3D:, getName(): string, setName(name: string): this what mean. I never seen :…
trinitrotoluene
  • 307
  • 2
  • 5
  • 14
-1
votes
1 answer

How to get the state from redux-saga select()?

the saga like below. function *callUserAuth(action) { const selectAllState = (state) => state; const tmp = yield select(selectAllState); console.log(tmp); } the console show enter image description here how can i get state like…
kennymarx0
  • 13
  • 5
-1
votes
1 answer

Push to array in nested immutable object

Please i want to have object like below from none existing group object. { name: '', group: { [nameValue]: [1,2,3,4] } } I want to push an item to the [nameValue] provided it match the text. My code below myObj.mergeDeep(myObj , { …
Nuru Salihu
  • 4,756
  • 17
  • 65
  • 116
-1
votes
2 answers

More direct way to return object's specific value from an array in javascript?

So I encountered a situation which left me wanting a different solution. I have an immutable array of objects. [ { id: 0, value:10 }, { id: 1, value:20 }, { id: 2, value:20 }, ] and I needed to search through the…
bauervision
  • 847
  • 2
  • 9
  • 25
-1
votes
1 answer

Convert immutable object to plain object

I am working with reactjs and don't know why I am getting data like Map {size: 5, _root: ArrayMapNode, __ownerID: undefined, __hash: undefined, __altered: false} Why I am getting this type of data on simple form submit?... How do I change this in…
Ashh
  • 44,693
  • 14
  • 105
  • 132
-1
votes
1 answer

TypeError: Cannot read property 'valueSeq' of undefined

I'm getting a strange Error in React.js. Not sure if it's because Im using immutable as a package. But either way heres the errors: Store.getMessages src/store.js:26 23 | this.update() 24 | } 25 | getMessages(){ > 26 | return…
newrobot
  • 9
  • 1
  • 3
-1
votes
1 answer

How delete from Immutable.List

Why deleteIn doesn't work for List? How to fix it so that the data remains immutable? import {OrderedMap, Record, List} from 'immutable'; const ReducerState = Record({ completedCount: new List([1,2,3]) }); const defaultState…
Qwerty
  • 314
  • 4
  • 16
-1
votes
1 answer

Updating an item in Redux using ImmutableJS given a key

Redux State: let initialState = Immutable.fromJS({ budgetItems: [], editingBudget: [[]] }); Trying to update items in the budgetItems section, which is an array of objects. The structure of the objects in the array is like: let initBudget =…
John Lippson
  • 1,269
  • 5
  • 17
  • 36
-1
votes
1 answer

Retrieve elements removed by List splice

Is there a way to receive the elements that were excluded from a List during a splice() operation? splice() seems to return a new List with the elements spliced excluded, which is what I expected according to the API, but I am not sure how to get…
zero298
  • 25,467
  • 10
  • 75
  • 100
-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
  • 15,428
  • 20
  • 55
  • 85
-1
votes
1 answer

Is immutable.js interchangeable with redis on a server?

Immutable.js states (https://facebook.github.io/immutable-js/) Immutable.js provides many Persistent Immutable data structures including: List, >Stack, Map, OrderedMap, Set, OrderedSet and Record. These data structures are highly efficient on…
1 2 3
80
81