1.1.1 • Published 2 years ago

brain-store-react v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
2 years ago

brain-store-react

基于 store 处理的一些函数,组件等。如绑定状态,扩展 mobx-react Provider 组件。

use

API

  • bind

    import Store,{ StoreModules } from 'brain-store';
    @StoreModules('ContainerStore')
    export default class ContainerStore extends StoreBase{
    static meta={
      ..StoreBase.meta,
      eventScopes:[],
      contextTypes:{
      }
    }
    constructor(context){
        super(context);
    }
    @observable count;
    
    @action
    setCount(){
      this.count++;
    }
    }
    import { bind } from 'brain-store-react';
    import React from 'react';
    @bind({ store: ContainerStore })
    export default class ReactTest extends React.Component {
      constructor(props) {
        super(props);
        this.props.store;
      }
    }
  • Provider

    import { Provider } from 'brain-store-react';
    import React from 'react';
    export default class ProviderTest extends React.Component {
      render() {
        const { store, children } = this.props;
        return <Provider store={store}>{children}</Provider>;
      }
    }
  • observer
    import {observer} from 'brain-store-react';

Licensing

MIT license

1.1.1

2 years ago

1.1.0

3 years ago

1.0.2

5 years ago

1.0.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago