0.0.7 • Published 4 years ago

mobx-method-decorators v0.0.7

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

Node.js CI

mobx-method-decorators

  • Assist reaction(...) calling with class-oriented way.

How to use?

isntall

yarn add mobx-method-decorators

write code

import mobx from 'mobx';
import { ReactableMixin, reactionMethod } from 'mobx-method-decorators';

const store = mobx.observable({
  message: 'Hello world.',
});

class Sample extends ReactableMixin {
  constructor() {
    this.makeReactable();
  }

  @reactionMethod(() => store.message)
  method() {
    // Execute whenever store.message changed.
  }

  detach() {
    // Dispose any reactions, call `unmakeReactable`
    this.unmakeReactable();
  }
}

Copyright

MIT

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago