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 value to "myList", thereby updating state
?
emails = List(new Array<string>());
defaultValues = ['[email protected]', '[email protected]'];
this.emails = this.emails.push(...this.defaultValues);
This is for typescript .
You can use update() method.
const initialState = Immutable.fromJS({});
const state = initialState.set('myList', Immutable.List());
const updatedState = state.update('myList', myList => myList.push('some value'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With