I have a mobx observable object:
@observable friend = {name: 'bert'}
And I have a mobx action which updates the object:
@action addAge = () => this.friend.age = 20
But my friend object doesn't update.
I have looked into the mobx docs and it seems map may be the correct thing to use because it takes into account new items placed into an object. However this seems to be more tailored to arrays. extendObservable seems to be more tailored to classes.
What is good practise for adding to a mobx observable object?
nullvalues, and it will work:observable friend = { name: 'bert', age: null };. If the keys can be totally dynamic, you need to use a map. - Tholle