mobx listen to changes
import { observable, observe } from "mobx"
const person = observable({
firstName: "Maarten",
lastName: "Luther"
})
const disposer = observe(person, change => {
console.log(change.type, change.name, "from", change.oldValue, "to", change.object[change.name])
})
person.firstName = "Martin"
// Prints: 'update firstName from Maarten to Martin'
disposer()
// Ignore any future updates
// observe a single field
const disposer2 = observe(person, "lastName", change => {
console.log("LastName changed to ", change.newValue)
})