# @onaio/connected-reducer-registry

> Connected Reducer Registry

Latest version **0.0.3** (published 2020-03-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @onaio/connected-reducer-registry
pnpm add @onaio/connected-reducer-registry
yarn add @onaio/connected-reducer-registry
bun add @onaio/connected-reducer-registry
```

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-03-10 |
| First published | 2019-04-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Ona Engineering |
| Maintainers | onaio |

## Links

- npm: https://www.npmjs.com/package/@onaio/connected-reducer-registry
- Repository: https://github.com/onaio/js-tools
- Homepage: https://github.com/onaio/js-tools#readme
- Issues: https://github.com/onaio/js-tools/issues
- npm.io page: https://npm.io/package/@onaio/connected-reducer-registry

## Dependencies (1)

- [@onaio/redux-reducer-registry](https://npm.io/package/@onaio/redux-reducer-registry.md) ^0.0.9

## Recent versions

- 0.0.3 (latest) — 2020-03-10
- 0.0.2 — 2019-12-13
- 0.0.1 — 2019-04-16

## README

# Connected Reducer Registry

This package primarily provides a "connected reducer registry".

But what does this even mean? To explain that, let us talk about the two things that this package provides:

## 1. Connected redux store

```ts
import store from '@onaio/connected-reducer-registry';
```

This is a redux store that:

- works with the Reducer Registry i.e. any reducers added to the Reducer registry will be added to the Redux store dynamically
- is integrated with [connected-react-router](https://github.com/supasate/connected-react-router)
- is integrated with [redux thunk](https://github.com/reduxjs/redux-thunk)
- includes redux dev tools for easy debugging

By default, the store that is provided includes only a router reducer.

## 2. A way to created a connected redux store

```ts
import { combine } from '@onaio/redux-reducer-registry';
import { connectReducer, getConnectedStore } from '@onaio/connected-reducer-registry';
import someReducer from 'somewhere'; // obviously change this!

/** create default reducers */
const defaultReducers = {
  router: connectReducer as any,
  anotherReducer: someReducer
};

/** Create the store */
const store = getConnectedStore(defaultReducers);

/** Set listener to add reducers to store when registered */
reducerRegistry.setChangeListener(reducers => {
  store.replaceReducer(combine(reducers));
});
```

## Redux modules

We highly recommend and encourage that you use [redux modules](https://github.com/erikras/ducks-modular-redux).

---
_Source: https://npm.io/package/@onaio/connected-reducer-registry · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
