Object.observe is dead. Long live MobX.observe

How does it work?

Beyond ‘observe’

Limitations

  1. Adding a new property to an existing object is not detected automatically. Either declare the property upfront with an ‘undefined’ value, use ‘mobx.extendObservable’ to add the property, or create an observable ES6 like map using ‘mobx.map()’.
  2. Observable arrays aren’t actually arrays but objects instead. They behave just like normal arrays but external libraries might not properly recognize them. In such cases, just ‘.slice()’ the array before passing it to an external library.

--

--

Lead Developer @Mendix, JS, TS & React fanatic, dad (twice), creator of MobX, MX RestServices, nscript, mxgit. Created.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store