It is like original makeAutoObservable function which allows inheritance for Mobx stores
npm install mobx-store-inheritance
makeAutoObservable function does not supporting subclassing. It is described in the Mobx docs.This package fixed this.
A code in this package is a bit tuned copy paste from this answer about inheritance in Mobx.
Tested in production at few different projects
It is easy: use makeAutoObservable in constructor of _inherited_ store.
``javascript
import makeAutoObservable from 'mobx-store-inheritance'
class BaseStore {
theField = 1
theMethod() {
return this.theField
}
}
class InheritedStore extends BaseStore {
constructor() {
makeAutoObservable(this)
}
theProperty = 'Ineritance is good'
}
``