Created
August 18, 2014 16:00
-
-
Save AndrewIngram/0ee71fa20b577b869eb1 to your computer and use it in GitHub Desktop.
Immutable JS Cursors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Immutable = require('immutable'); | |
var data = Immutable.fromJS({ a: { b: { c: 1 } } }); | |
data.toJS(); | |
// { a: { b: { c: 1 } } } | |
var cursor = data.cursor(['a'], function(newData) { data = newData; }); | |
cursor.set('d', 2); | |
data.toJS(); | |
// { a: { b: { c: 1 }, d: 2 } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment