Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

immutablejs update use

 // Act on a single key/value in a Map​const avengersMap = Immutable.Map({  ironMan: 'Tony Stark',  captainAmerica: 'Steve Rogers',  blackWidow: 'Natasha Romanov'});​const updatedAvengers = avengersMap.update('ironMan', (ironManValue) => {  // ironManValue is a JavaScript type - no need for Immutable   // functions to modify it  return ironManValue + ' is ironMan';});​// Output:updatedAvengers Object {  "blackWidow": "Natasha Romanov",    "captainAmerica": "Steve Rogers",      "ironMan": "Tony Stark is ironMan",}
Source by untangled.io #
 
PREVIOUS NEXT
Tagged: #immutablejs #update
ADD COMMENT
Topic
Name
2+6 =