Created
April 27, 2018 11:32
-
-
Save linus-amg/1e1926f95aae401eadfc8b05b28588c8 to your computer and use it in GitHub Desktop.
UIStore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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