Questions tagged [immutability-helper]

23 questions
0
votes
1 answer

can not update state with immutability helper

i have object in my state and nested object inside parent object, and updating objects in state may cause state mutating and lots of answers adviced to use immutability-helpers, (react-addons-update) this is my state: this.state = { …
iLiA
  • 3,053
  • 4
  • 23
  • 45
0
votes
0 answers

React setState not passing updated state data as prop to component render?

I am a React beginner, trying to make a card game app (using 'react-dnd' for drag and drop functionality). The board state (where the cards are placed) of this app is a 4x4 grid, stored as a 2d array (Initial examples are truncated) this.state = { …
damon
  • 2,687
  • 8
  • 25
  • 35
0
votes
0 answers

setState changes the state but the value in textfield does not change

I have dynamic number of textfileds and i saved the values to those textfields in an array. At first the values get populated with data from server using immutability helper but when i want to edit the textfiled it does not change. when I print the…
0
votes
0 answers

Using immutability-helper, how to set the property of an instance of a class without cloning other fields?

Here is an example: class ExampleClass { private x: number; private ary: number[]; constructor(x, ary = []) { this.x = x; this.ary = ary; } public getX() { return this.x; } public setX(x) { …
0
votes
1 answer

Typescript + immutability-helper #set

I've come to join the typescript wagon and i wantede to keep using this immutability-helper lib when im updating my redux store, but for some reason now i get this error when im trying to execute a update?: [ts] Argument of type '{ flags: {…
0
votes
0 answers

Best way to update nested array using immutability-hepler

I'm using immutability-helper to update state, in React. I used to update things like this: const newElement = update(element, { x: { $apply: function(x) { return x * width; } }, …
0
votes
1 answer

immutability-helper - Stuck on manipulating simple objects

I have two types of manipulations I would like to make with immutability-helper, but I am very stuck. I have this data, mocking the results from an API: var test_data = { title: "Potato", sounds: [ { sound_name: "Fork", id: 27 }, {…
Grapehand
  • 19
  • 5
0
votes
1 answer

Immutability-Helper Updating One Property but not Others?

I have a jsx style that looks like this: let styles = { appBarStyle: { display: 'flex', flexWrap: 'nowrap', WebkitFlexFlow: 'nowrap', flex: '1 1 0%', alignItems: 'center', justifyContent:…
VikR
  • 4,818
  • 8
  • 51
  • 96
1
2