Created
July 28, 2015 18:27
-
-
Save mattmccray/c5b6c69c1653b941ccd7 to your computer and use it in GitHub Desktop.
Immobservable?
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
import mobservable from 'mobservable/immutable' // Separate module needed? | |
// Not sure, but basically we need | |
// to mark it as immutable somehow | |
let user = mobservable.fromJson({ | |
name: 'Matt', | |
age: 'NunYoBiznis' | |
}) | |
user.name //= 'Matt' | |
user.name = 'Matthew' // ignored | |
user.name //= 'Matt' | |
mobservable.transaction(() => { | |
user.name = 'Matthew' // applied | |
user.name //= 'Matthew' | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍
See: mobxjs/mobx#9