1.0.6 • Published 10 months ago

mobx-store-inheritance v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Mobx store inheritance

What is this?

The 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

How to use?

It is easy: use makeAutoObservable in constructor of inherited store.

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'
}
1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.1-0

10 months ago