# react-redux-helper-tools

> 让react-redux像vuex一样轻松，使用起来很动感丝滑

Latest version **0.0.12** (published 2021-04-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-redux-helper-tools
pnpm add react-redux-helper-tools
yarn add react-redux-helper-tools
bun add react-redux-helper-tools
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2021-04-19 |
| First published | 2021-03-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | kevintan |
| Maintainers | kevintanhappy |

## Links

- npm: https://www.npmjs.com/package/react-redux-helper-tools
- npm.io page: https://npm.io/package/react-redux-helper-tools

## Recent versions

- 0.0.12 (latest) — 2021-04-19
- 0.0.11 — 2021-04-09
- 0.0.10 — 2021-04-01
- 0.0.9 — 2021-04-01
- 0.0.8 — 2021-03-31
- 0.0.7 — 2021-03-31
- 0.0.6 — 2021-03-31
- 0.0.5 — 2021-03-31
- 0.0.4 — 2021-03-31
- 0.0.3 — 2021-03-31
- 0.0.2 — 2021-03-31
- 0.0.1 — 2021-03-30

## README

第一步，在view/login目录下创建model.ts，并暴露出去  
import {ReactModelHelper } from "react-redux-helper-tools";  
export default ReactModelHelper({  
  &nbsp; &nbsp; state: {  
    &nbsp; &nbsp; &nbsp; &nbsp; loading: false  
  &nbsp; &nbsp; },  
  &nbsp; &nbsp; action: {  
    &nbsp; &nbsp; &nbsp; &nbsp; loginAction(params: any): Promise<any> {  
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//this.dispatch({type: 'updateState', params: {loading: true}})  
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//this.dispatch({type: 'updateState', params: {loading: false}})  
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return new HttpTrigger(this.dispatch).exec('Login', params, 'loading').then((res: any) => {  
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Message.success('登录成功');  
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })  
    &nbsp; &nbsp; &nbsp; &nbsp; }  
  &nbsp; &nbsp; },  
  &nbsp; &nbsp; namespace: 'loginModel'  
})  
  
第二步，store引入  
import LoginStore from 'src/view/v-login/model';  
const rootReducers = combineReducers({  
  &nbsp; &nbsp; LoginStore  
});  
export const store = createStore(rootReducers);  

第三步，tsx页面使用  
import { ModelHelperXoo, getNamespaceModel } from "react-redux-helper-tools";  
3.1 创建component,并使用ModelHelperXoo函数初始化  
class Login extends React.Component {  
	&nbsp; &nbsp; constructor(props){  
		&nbsp; &nbsp; &nbsp; &nbsp; this.loginModel = getNamespaceModel('loginModel', this);  
	&nbsp; &nbsp; }  
}  
//'LoginStore.loading.subLoading' subLoading为页面使用的别名，如：{this.props.subLoading}这么来使用  
export default ModelHelperXoo(['LoginStore.loading.subLoading'], ['loginModel'], Login);  
3.2 在constructor中获取到model  
this.loginModel = getNamespaceModel('loginModel', this);  
3.3 点击提交登录  
this.loginModel.loginAction({})  

---------------------------------QQ：276034602，加我请备注。--------------------------------------

---
_Source: https://npm.io/package/react-redux-helper-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
