# aivis-connect

> Apply props-actions-context-logic to props

Latest version **0.4.1** (published 2019-09-25) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install aivis-connect
pnpm add aivis-connect
yarn add aivis-connect
bun add aivis-connect
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2019-09-25 |
| First published | 2019-01-16 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=11.6.0 |
| Dependencies | 11 |
| Unpacked size | 71.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aivis |
| Maintainers | aivislisovskis |
| Keywords | connect |

## Links

- npm: https://www.npmjs.com/package/aivis-connect
- Repository: https://github.com/aivislisovskis/connect
- Homepage: http://www.aivis.lv
- Issues: https://github.com/aivislisovskis/connect/issues
- npm.io page: https://npm.io/package/aivis-connect

## Dependencies (11)

- [react](https://npm.io/package/react.md) ^16.8.6
- [redux](https://npm.io/package/redux.md) ^4.0.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [graphql](https://npm.io/package/graphql.md) ^14.2.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.0.0
- [reselect](https://npm.io/package/reselect.md) ^3.0.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.8.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.0
- [react-redux](https://npm.io/package/react-redux.md) ^7.1.0
- [react-apollo](https://npm.io/package/react-apollo.md) ^2.5.4
- [apollo-client](https://npm.io/package/apollo-client.md) ^2.5.1

## Recent versions

- 0.4.1 (latest) — 2019-09-25
- 0.4.0 — 2019-09-25
- 0.3.0 — 2019-07-25
- 0.2.0 — 2019-07-24
- 0.1.7 — 2019-07-24
- 0.1.6 — 2019-05-08
- 0.1.5 — 2019-05-08
- 0.1.4 — 2019-05-08
- 0.1.3 — 2019-05-08
- 0.1.2 — 2019-05-08
- 0.1.1 — 2019-04-25
- 0.1.0 — 2019-04-11
- 0.0.3 — 2019-04-11
- 0.0.2 — 2019-01-16
- 0.0.1 — 2019-01-16

## README

# aivis-connect

## Description
Decorators to make connecting props and actions more readable

## Installation
```
npm install aivis-connect
```

## Submodules
- [connect](./src/connect#readme)
- [prefetch](./src/prefetch#readme)

## Usage example

#### connect.js
``` javascript
import createConnectWrappers from 'aivis-connect';
import actions from '../common/actions';
import selectors from '../common/selectors';

const {
  connect: connectDecorator,
  connectState: connectStateDecorator,
  connectSelectors: connectSelectorsDecorator,
  connectActions: connectActionsDecorator,
  connectPrefetch: connectPrefetchDecorator,
} = createConnectWrappers({ actions, selectors });

export const connectState = connectStateDecorator;
export const connectSelectors = connectSelectorsDecorator;
export const connectActions = connectActionsDecorator;
export const connectPrefetch = connectPrefetchDecorator;

export default connectDecorator;
```

#### App.js
```javascript
import connect from '../connect';

@connect({
  state: {
    data: ['appStore', 'data']
  },
  actions: {
    sendData: ['api', 'sendData']
  },
  selectors: {
    complexData: ['appSelector', 'complexData']
  },
  prefetch: [
    ['api', 'prefetchSomething']
  ]
})
class App extends Component {
  render() {
    return <div />;
  }
}
```

You can also use each of connect decorators separately
```javascript
import { connectState, connectActions, connectSelectors, connectPrefetch } from '../connect';

@connectState({
  data: ['appStore', 'data']
})
@connectActions({
  sendData: ['api', 'sendData']
})
@connectSelectors({
  complexData: ['appSelector', 'complexData']
})
@connectPrefetch([
  ['api', 'prefetchSomething']
])
class App extends Component {
  render() {
    return <div />;
  }
}
```

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