immutable.js Questions
2
How, using ImmutableJS, do I produce a new map by mapping over the key/value pairs of an input map?
In Scala, I would do something like this:
scala> Map(1->2, 3->4).toSeq.map{case (k, v)...
Cratch asked 29/8, 2016 at 4:21
14
Solved
I am currently working on React JS and React Native frameworks. On the half way road I came across Immutability or the Immutable-JS library, when I was reading about Facebook's Flux and Redux imple...
Fbi asked 20/12, 2015 at 20:0
7
I am looking to store a list of unique string (hence Set) and wanted to retrieve the value based on the index. I used get(index) But it turned out it returns undefined. So it seems I did not unders...
Alfalfa asked 23/6, 2017 at 7:9
8
I've got a prop on a ReactJS Component that's either null or an Immutable Map.
At the bottom of my widget if I write:
MyComponent.propTypes = {
myMap: React.PropTypes.instanceOf(Immutable.Map)
...
Judaism asked 21/11, 2016 at 21:23
3
Solved
I have a react-redux application written in typescript with immutable package. There I have a data, which comes from api and in store I pack it to Map. In all application they are used as a Map.
I...
Amusement asked 25/4, 2017 at 10:7
2
I want to be able to look at my immutable objects for debugging. I find it very difficult to look through an object by clicking on entries and such. Ideally what I would like is the opposite of the...
Myalgia asked 10/2, 2016 at 19:59
4
Solved
I am missing a option how to get the index number inside the map function using List from Immutable.js:
var list2 = list1.map(mapper => { a: mapper.a, b: mapper.index??? }).toList();
Document...
Ackley asked 14/7, 2016 at 2:7
2
Solved
I am currently following this tutorial. I've hit a bit of a snag involving mapStateToProps in the following code:
import React from 'react';
import Voting from './voting';
import {connect} from 'r...
Arboretum asked 16/8, 2016 at 13:21
2
I'm working on a Vue.js application where I have to deal with deeply nested data structures (trees and forests).
After reading about using simple data structures, pure functions and reducing (non-...
Blotch asked 27/1, 2018 at 11:18
2
I am new to immutable.js. Is there any difference between map from immutable.js and map from ES6? If there is no difference, why do we need to use immutable.js?
immutable.js
const { Map } = requi...
Oddson asked 26/9, 2017 at 17:52
2
Solved
I am using immutable-js and react-immutable-proptypes in React.
// CommentBox.jsx
getInitialState() {
return {
comments: Immutable.List.of(
{author: 'Pete Hunt', text: 'Hey there!'},
{author: ...
Homeopathy asked 23/8, 2015 at 10:2
5
Solved
I have worked on a couple of projects using React.js. Some of them have used Flux, some Redux and some were just plain React apps utilizing Context.
I really like the way how Redux is using funct...
Niela asked 29/4, 2019 at 14:47
6
How is possible to change 3/4 elements? Expected output is [1,2,4,3,5]
let list = [1,2,3,4,5];
const removeElement = list.indexOf(3); // remove number 3
list.slice(0, removeElement).concat(list.sl...
Vesper asked 22/11, 2016 at 8:56
3
Solved
As the title states, I want to get the index of a particular item. Is there a way to do this?
const key = 1
const map = new Immutable.OrderedMap([5, 'a'], [3, 'b'], [1, 'c'])
So, in this case, t...
Chemurgy asked 10/9, 2015 at 20:27
1
Is there a way to diff objects in Immutable?
Example:
let a = Immutable.fromJS({ a: 10 });
let b = Immutable.fromJS({ b: 10 });
let d = Immutable.diff(a, b);
// { a: 10 }
console.log(d.toJS())...
Gold asked 22/7, 2015 at 16:26
4
Solved
I want to retrieve keys() from the following Immutable Map:
var map = Immutable.fromJS({"firstKey": null, "secondKey": null });
console.log(JSON.stringify(map.keys()));
I would expect the output...
Calamus asked 25/2, 2016 at 9:33
3
Solved
Question
Is there something wrong with my benchmark? How can Immutable.js find() be 8 times slower than array.find()?
Ok, not entirely fair, since I'm using Immutable.Map inside of the Immutable...
Fickle asked 2/2, 2017 at 14:34
7
Solved
Here is what official docs said
updateIn(keyPath: Array<any>, updater: (value: any) => any): List<T>
updateIn(keyPath: Array<any>, notSetValue: any, updater: (value: any) =>...
Temple asked 12/4, 2015 at 13:1
2
Solved
I've got an immutable map of maps.
let mapOfMaps = Immutable.fromJS({
'abc': {
id: 1
type: 'request'
},
'def': {
id: 2
type: 'response'
},
'ghi': {
type: cancel'
},
'jkl': {
type: 'ed...
Procephalic asked 7/11, 2016 at 22:7
2
Solved
It seems like when using redux with react, immutable.js has become almost a industry standard.
My question is, aren't we making changes to our redux states immutably when we are using the spread op...
Scouring asked 22/11, 2018 at 21:1
3
Solved
So, I have List a:
let a = Immutable.List([1])
and List b:
let b = Immutable.List([2, 3])
I want to get List union === List([1, 2, 3]) from them.
I try to merge them fist:
let union = a.me...
Hirohito asked 8/5, 2015 at 14:48
1
I would like Sanctuary to provide Fantasy Land -compatible Map and Set types with value-based equality semantics. Ideally these values would be immutable, though this is not critical since Sanctuar...
Adhesive asked 18/9, 2016 at 11:50
2
I have angular2 app and i'm using immutable.js. When i use user Map function from immutable typescript compiler gets stuck. When i don't import the typing from immutable.js it works fine but i get ...
Beatific asked 9/2, 2016 at 16:38
2
Solved
I have a immutable list object, within a Map object, as follows:
let initialState = Immutable.fromJS({});
state = initialState;
state = state.set("myList", Immutable.List());
How do I append a v...
Board asked 14/11, 2016 at 13:30
4
In my application I use D3.js for some visualizations.
Now D3 works with mutable native JavaScript data structures.
So some data marshalling would be necessary for this to work with Immutable.js...
Yellowbird asked 8/4, 2015 at 12:52
1 Next >
© 2022 - 2024 — McMap. All rights reserved.