# redux-affix

> A react-redux's connect function with additional shorthand syntax.

Latest version **1.0.8** (published 2017-04-04) · ISC license · 0 weekly downloads

## Install

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

## 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.8 |
| Published | 2017-04-04 |
| First published | 2017-04-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | James Meyers |
| Maintainers | simplej |
| Keywords | react, redux |

## Links

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

## Dependencies (2)

- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.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.8 (latest) — 2017-04-04
- 1.0.7 — 2017-04-03
- 1.0.6 — 2017-04-03
- 1.0.5 — 2017-04-03
- 1.0.4 — 2017-04-03
- 1.0.3 — 2017-04-03
- 1.0.2 — 2017-04-03
- 1.0.1 — 2017-04-03
- 1.0.0 — 2017-04-03

## README

# redux-affix

A react-redux's connect function with additional shorthand syntax.

# Usage

`affix` behaves exactly like React-Redux's `connect` function when `mapStateToProps` and `mapDispatchToProps` are functions.

### Pass single state key as `mapStateToProps`

```javascript
affix('todos')
```

With `connect`:

```javascript
connect(({todos}) => ({todos}))
```

### Pass state keys as `mapStateToProps`

```javascript
affix(['todos', 'user'])
```

With `connect`:

```javascript
connect(({todos, user}) => ({todos, user}))
```

### Pass state paths as `mapStateToProps`

```javascript
affix({username: 'user.name', todoCount: 'todos.length'})
```

With `connect`:

```javascript
connect(({todos, user}) => ({
  username: user.name,
  todoCount: todos.length
}))
```

### Pass action creators as `mapDispatchToProps`

```javascript
affix(mapStateToProps, {onToggleTask: toggleTask})
```

With `connect`:

```javascript
connect(mapStateToProps, (dispatch) => ({
  onToggleTask(taskId) {
    return dispatch(toggleTask(taskId));
  }
}))
```

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