Skip to content

Instantly share code, notes, and snippets.

@js2me
Created May 21, 2019 12:15
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 js2me/891e37f8e72bddd601b7a4679d57526d to your computer and use it in GitHub Desktop.
Save js2me/891e37f8e72bddd601b7a4679d57526d to your computer and use it in GitHub Desktop.
// ./modules/index.js
// don't worry about context. It links when module attaching to the store!
// Also all methods (like 'this.setState' ) from StonexModule class automatic will been inherited
const pureModule = {
state: {},
addItem(item){
this.setState({...this.state, [item.name]: item })
}
}
const modules = {
pureModule
}
export default modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment