Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created April 27, 2018 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/1e1926f95aae401eadfc8b05b28588c8 to your computer and use it in GitHub Desktop.
Save linus-amg/1e1926f95aae401eadfc8b05b28588c8 to your computer and use it in GitHub Desktop.
UIStore
import { action, observable } from 'mobx';
const DEFAULT_STATE = {
counter: 0,
};
class UIStore {
@observable state;
constructor(initialState = DEFAULT_STATE) {
this.state = Object.assign({}, initialState);
}
@action
incrementCounter = () => {
this.state.counter += 1;
};
}
export default UIStore;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment