2.0.0 • Published 6 years ago

reducermanger v2.0.0

Weekly downloads
21
License
ISC
Repository
github
Last release
6 years ago

Redux's reducer management and leave page data destruction

(1)处理Redux的reducer集中管理的问题

(2)防止action的type重复问题

(3)离开页面再次进入该页面的数据初始化问题

├── lib
│
├── src
│
├── .babelrc
│
├── .gitignore
│
├── .npmignore
│
├── .prettierignore
│
├── .prettierrc
│
├── package.json
│
├── package-lock.json
│
└── readMe.md

Example

 action.js:

   import { getActionType } from 'reducermanger';
   const homeType = getActionType('Home');
   

 index.js:

    import { RtRdCon, getActionType } from 'reducermanger';
    const homeType = getActionType('Home');
    @RtRdCon
    export default class Home extends React.Component{
        static mapStateToProps = (state, ownProps) => {
            return {
                Home: state.Home
            };
        };
    
        static mapDispatchToProps = (dispatch, ownProps) => {
            return {
            };
        };
    }
    

 reducer.js:

    import { store, storeProps } from 'reducermanger';
    @store
    class Home {
        @storeProps('change_searchForm', true)
        static searchForm = {
            count: 0,
            pageIndex: 1,
            pageSize: 100000
        };
    
        @storeProps('change_selectProjectId', true)
        static selectProjectId = "";
    
        @storeProps('change_projectList', true)
        static projectList = [];
    
        @storeProps('change_statistics', true)
        static statistics = {};
    
        @storeProps('change_projectStatistics', true)
        static projectStatistics = {};
    }
    

 app.js:
    import './home/reducer';
    import { getStore } from 'reducermanger';
    const store = createStore(getStore(), applyMiddleware(thunk));
2.0.0

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago