@efox/emp-single-mobx6
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta1.12 • Public • Published

@efox/emp-single-mobx6

单例mobx,实现跨组件、Iframe间通信

🔗 Install

yarn add @efox/emp-single-mobx6

Use

import {empCreateClassStore, makeAutoObservable} from '@efox/emp-single-mobx6'

class DemoStore {
  count = 2
  list = [{index: 0, person: {name: 'Lion', age: 12}}]
  constructor() {
    makeAutoObservable(this)
  }
  addCount() {
    this.count += 1
  }
  pushList() {
    this.list.push({...this.list[0], index: this.list.length})
  }
}

export default empCreateClassStore<DemoStore>(DemoStore)



const DemoComponent = () => {
  return <div>{demoStore.count}</div>
}
export default Obserer(DemoComponent)

Package Sidebar

Install

npm i @efox/emp-single-mobx6

Weekly Downloads

0

Version

1.0.0-beta1.12

License

MIT

Unpacked Size

12.8 kB

Total Files

17

Last publish

Collaborators

  • ron0115
  • hiitiger
  • ckken
  • doerme
  • hupp
  • magic_zhong
  • yz101x
  • wangcylive
  • tim2018
  • linhaoran
  • yangshangzhi
  • lucky-dog
  • wu_wei
  • nijina
  • zhengy1995
  • bennyshi
  • yellowbeee
  • keylenn