Skip to content

Instantly share code, notes, and snippets.

@BenjaminVerble
Created October 5, 2016 05:00
Show Gist options
  • Save BenjaminVerble/86d06fc2f9d94aa647a96e47ccdb6254 to your computer and use it in GitHub Desktop.
Save BenjaminVerble/86d06fc2f9d94aa647a96e47ccdb6254 to your computer and use it in GitHub Desktop.
import Immutable from 'immutable'
const nested = Immutable.fromJS({a:1, b:2, pieces:[]})
const nested2 = nested.updateIn(['pieces'], list => list.push({player: 'player1'}));
const nested3 = nested2.updateIn(['pieces'], list => list.push({player: 'player2'}));
bin.log(nested3.toJS())
const nested4 = nested3.updateIn(['pieces'], list => list.pop())
bin.log(nested4.toJS())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment