Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created Apr 27, 2018
Embed
What would you like to do?
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