# redux-async-injector

> redux 异步加载

Latest version **1.0.1** (published 2017-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-async-injector
pnpm add redux-async-injector
yarn add redux-async-injector
bun add redux-async-injector
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-10-06 |
| First published | 2017-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | webliving |
| Maintainers | webliving |
| Keywords | redux, react |

## Links

- npm: https://www.npmjs.com/package/redux-async-injector
- Repository: https://github.com/webliving/redux-async-injector
- Homepage: https://github.com/webliving/redux-async-injector#readme
- Issues: https://github.com/webliving/redux-async-injector/issues
- npm.io page: https://npm.io/package/redux-async-injector

## Dependencies (2)

- [redux](https://npm.io/package/redux.md) ^3.0.2
- [lodash](https://npm.io/package/lodash.md) ^4.15.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-10-06
- 1.0.0 — 2017-10-05

## README

# redux-async-injector
![version](https://img.shields.io/github/release/webliving/redux-async-injector.svg)
![download](https://img.shields.io/npm/dm/mytool.svg)

运行时动态注入 redux store

## 安装
Install ```redux-async-injector``` via npm.

```javascript
npm install --save redux-async-injector
```

然后, 使用你中意的:heart_decoration:一种引用方法使用本模块 :
```javascript
// using an ES6 transpiler, like babel
import { createInjectStore } from 'redux-async-injector';

// not using an ES6 transpiler
var createInjectStore = require('redux-async-injector').createInjectStore;
```

## 使用
示例如下:

### 创建 redux store
应用的redux数据的创建

#### 1. 你应该不需要做什么,大体上你的reducer配置都类似这样?
```javascript
let reducersObject = {
  menuList: menuListReducerFn,
  data: {
    user: userReducerFn,
    auth: {
      loggedIn: loggedInReducerFn,
      loggedOut: loggedOutReducerFn
    },
    info: infoReducerFn
  }
};
```

### 2. 使用 createInjectStore 替换redux默认提供的 createStore
```javascript
import { createInjectStore } from 'redux-async-injector';

let store = createInjectStore(
  reducersObject,
  initialState // 默认数据
);
```

### 注入新的 reducer
在 redux store 创建之后, 你可以在任何合理的地方,简单的注入新的 reducer
```javascript
import { injectReducer } from 'redux-async-injector';

injectReducer('store.form', formReducerFn);
```

## License

MIT

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