# thesmo-redux-dispatch

> Redux dispatch which provides performing any store action at any nested level in one line

Latest version **3.0.1** (published 2020-04-22) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install thesmo-redux-dispatch
pnpm add thesmo-redux-dispatch
yarn add thesmo-redux-dispatch
bun add thesmo-redux-dispatch
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2020-04-22 |
| First published | 2020-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 48.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | revrulb |
| Maintainers | revrulb |
| Keywords | redux, reducer, state, dispatch, action, functional, fp, calculating-field, clone, state-management, data-manipulation |

## Links

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

## Dependencies (3)

- [redux](https://npm.io/package/redux.md) ^4.0.5
- [thesmo-calc-fields-base](https://npm.io/package/thesmo-calc-fields-base.md) ^5.0.1
- [thesmo-calc-fields-object](https://npm.io/package/thesmo-calc-fields-object.md) ^5.0.1

## Alternatives

- [@reckona/mreact-store](https://npm.io/package/@reckona/mreact-store.md) — 976 weekly downloads
- [regular-state](https://npm.io/package/regular-state.md) — 410 weekly downloads
- [@pacote/flux-actions](https://npm.io/package/@pacote/flux-actions.md) — 65 weekly downloads
- [@pilotlab/lux-debug](https://npm.io/package/@pilotlab/lux-debug.md) — 39 weekly downloads
- [vue-persist-state](https://npm.io/package/vue-persist-state.md) — 19 weekly downloads

## Recent versions

- 3.0.1 (latest) — 2020-04-22
- 3.0.0 — 2020-04-19
- 2.0.5 — 2020-03-18
- 2.0.4 — 2020-03-18
- 2.0.3 — 2020-03-18
- 2.0.2 — 2020-03-18
- 2.0.1 — 2020-03-18
- 2.0.0 — 2020-03-18
- 1.0.9 — 2020-02-28
- 1.0.8 — 2020-02-27
- 1.0.7 — 2020-02-27
- 1.0.6 — 2020-02-27
- 1.0.5 — 2020-02-23
- 1.0.4 — 2020-02-23
- 1.0.3 — 2020-02-22
- … 4 more at https://npm.io/package/thesmo-redux-dispatch/versions

## README

<p align="center">
    <img src='https://raw.githubusercontent.com/revrulb/thesmo-redux-dispatch/master/logo.svg?sanitize=true'></img>
</p>

![npm](https://img.shields.io/npm/v/thesmo-redux-dispatch)
![GitHub](https://img.shields.io/github/license/revrulb/thesmo-redux-dispatch)
![GitHub last commit](https://img.shields.io/github/last-commit/revrulb/thesmo-redux-dispatch)
![npm](https://img.shields.io/npm/dm/thesmo-redux-dispatch)
![GitHub top language](https://img.shields.io/github/languages/top/revrulb/thesmo-redux-dispatch)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

# About

This package provides you using Redux store as tree. It gives you possibility of having updates and obtaining values by node path. You can apply changes to one node, multiple nodes or whole state at once. Changes can be applied via [calculating field](https://npmjs.com/thesmo-calc-fields-base).

# Functions

## **getReducer**

Returns reducer for Redux store which can be used with
following actions

```typescript
type Args = {
    defaultState?: object;
};

type Signature = ({ defaultState = {} }: Args) => Reducer
```

## **getUpdateMultipleNodesAction**

Returns action for multiple nodes update via calculating fields

```typescript
type UpdateNodePayload = {
    nodePath: string;
    calcField: SafeCF<any, any>;
};

type UpdateMultipleNodesPayload = { 
    updates: UpdateNodePayload[] 
};

type Args = UpdateMultipleNodesPayload;

type Signature = ({ updates }: Args) 
    => Action<string> & UpdateMultipleNodesPayload
```

## **getUpdateNodeAction**

Returns action for single node update via calculating field

```typescript
type UpdateNodePayload = {
    nodePath: string;
    calcField: SafeCF<any, any>;
};

type Args = UpdateNodePayload;

type Signature = ({
    calcField,
    nodePath
}: Args) => Action<string> & UpdateNodePayload
```

## **getUpdateWholeStateAction**

Returns action for updating whole store via calculating field

```typescript
type UpdateWholeStatePayload = {
    calcField: SafeCF<any, any>;
};

type Args = UpdateWholeStatePayload;

type Signature = ({ 
    calcField
}: Args) => Action<string> & UpdateWholeStatePayload
```

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