# redux-lift

> Store composition for redux.

Latest version **0.1.3** (published 2015-11-04) · CC0-1.0 license · 0 weekly downloads

## Install

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

## 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.3 |
| Published | 2015-11-04 |
| First published | 2015-10-31 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Izaak Schroeder |
| Maintainers | izaakschroeder |

## Links

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

## Dependencies (1)

- [redux](https://npm.io/package/redux.md) ^3.0.3

## Recent versions

- 0.1.3 (latest) — 2015-11-04
- 0.1.2 — 2015-11-02
- 0.1.1 — 2015-10-31
- 0.1.0 — 2015-10-31

## README

# redux-lift

Store composition for [redux].

![build status](http://img.shields.io/travis/izaakschroeder/redux-lift/master.svg?style=flat)
![coverage](http://img.shields.io/coveralls/izaakschroeder/redux-lift/master.svg?style=flat)
![license](http://img.shields.io/npm/l/redux-lift.svg?style=flat)
![version](http://img.shields.io/npm/v/redux-lift.svg?style=flat)
![downloads](http://img.shields.io/npm/dm/redux-lift.svg?style=flat)

The current primary composition mechanism in [redux] is [middleware]. While useful in altering the behavior of the `dispatch` function, it offers little control for composing multiple parts of an application that have different action or store needs. This is where [lifting] is useful.

Lifting allows you to "lift" your state, reducers and actions into another context. Lifting is a kind of [store enhancer] that is a superset of [middleware].

Indeed, the `applyMiddleware` function can be built trivially using `lift`:

```javascript
import lift from 'redux-lift';

function applyMiddleware(...args) {
  // `applyMiddleware` is really just lifting the dispatch function, nothing
  // more. Everything else is the identity lift.
  return lift({ liftDispatch: compose(...args) });
}
```

But the real power of lifting lies in its ability to manipulate the whole state tree, not just the dispatch function. What can you do with lifting?

 * Implement time-travel for dev-tools,
 * Keep track of promises for automatic server-side rendering,
 * Track ephemeral UI state,
 * Compose multiple redux apps together.


```javascript
import lift from 'redux-lift';


export default lift({

});
```

```javascript
function TextField({ value, onChange }) {
  return <input value={value} onChange={onChange} type='text'/>;
}

// https://github.com/rackt/react-redux/blob/master/src/components/connect.js
function ephemeral(eventMap) {
  return connect(function(state) {
    return {
      value: state.ephemeral[uniqueKey]
    }
  }, function(dispatch) {
    return {
      onChange: dispatch('EPHEMERAL', uniqueKey)
    }
  });
}

export default ephemeral({
  events: {
    onChange(ev) { return { value: ev.target.value; }}
  }
})(TextField);


```

[redux]: https://github.com/gaearon/redux
[middleware]: http://rackt.org/redux/docs/advanced/Middleware
[lifting]: http://stackoverflow.com/questions/2395697
[store enhancer]: https://github.com/rackt/redux/blob/master/docs/Glossary.md#store-enhancer

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