# dynamic-redux

> With dynamic redux you can inject your reducers on the fly

Latest version **0.1.6** (published 2019-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install dynamic-redux
pnpm add dynamic-redux
yarn add dynamic-redux
bun add dynamic-redux
```

## 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.1.6 |
| Published | 2019-09-29 |
| First published | 2019-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | nikandlv |
| Keywords | react, react-redux, redux, dynamic-redux |

## Links

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

## Dependencies (3)

- [redux](https://npm.io/package/redux.md) ^4.0.4
- [react-redux](https://npm.io/package/react-redux.md) ^7.1.1
- [redux-thunk](https://npm.io/package/redux-thunk.md) ^2.3.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

- 0.1.6 (latest) — 2019-09-29
- 0.1.5 — 2019-09-29
- 0.1.4 — 2019-09-29
- 0.1.3 — 2019-09-29
- 0.1.2 — 2019-09-29
- 0.1.1 — 2019-09-29
- 0.1.0 — 2019-09-29

## README

# Dynamic redux

> With dynamic redux you can inject your reducers on the fly

## Installation

```console

nikandlv@nikandlv.ir:~$ npm install redux react-redux redux-thunk

```

Then simply copy `Data` folder into your project

## Setup

### Import it

```javascript
import ReduxProvider from './Data/ReduxProvider'
```

### Wrap your root component or any base component

```javascript
ReactDOM.render(
    <ReduxProvider>
        <Application />
    </ReduxProvider>, document.getElementById('root'));
```

## Injecting a reducer

### Import the store and a reducer

```javascript
import CounterReducer from './Data/Reducers/CounterReducer'
import Store from './Data/Store'
```

### Inject your reducer

```javascript
Store.injectReducer('CounterReducer',CounterReducer)
```

`injectReducer` takes two parameters a `key` and the `reducer`

#### Use `withDynamic` builder

using `withDynamic` builder you can easily access your `reducers` and `actions` in your components

```javascript
import withDynamic from './Data/withDynamic';

export default withDynamic(MyComponent)
                .injectAction('name', func)
                .injectReducer('CounterReducer')
                .build()
```

there are 2 main functions

`injectAction` which takes function name and the action and injects it into your component props

`injectReducer` which takes a reducer name and injcets it into your component props

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