# vidom-redux

> Redux bindings for Vidom

Latest version **0.4.0** (published 2018-02-21) · MIT license · 0 weekly downloads

## Install

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

## 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.4.0 |
| Published | 2018-02-21 |
| First published | 2016-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Dmitry Filatov |
| Maintainers | dfilatov |
| Keywords | vidom, redux |

## Links

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

## Dependencies (2)

- [redux](https://npm.io/package/redux.md) ^3.5.2
- [vidom](https://npm.io/package/vidom.md) ^0.10.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2018-02-21
- 0.3.1 — 2017-04-11
- 0.3.0 — 2017-04-03
- 0.2.0 — 2017-02-09
- 0.1.2 — 2017-01-13
- 0.1.1 — 2016-08-08
- 0.1.0 — 2016-08-05
- 0.0.1 — 2016-08-05

## README

# vidom-redux
[![Build Status](https://img.shields.io/travis/dfilatov/vidom-redux/master.svg?style=flat-square)](https://travis-ci.org/dfilatov/vidom-redux/branches)
[![NPM Version](https://img.shields.io/npm/v/vidom-redux.svg?style=flat-square)](https://www.npmjs.com/package/vidom-redux)

## What is it?

This module provides [Redux](https://github.com/reactjs/redux) bindings for [Vidom](https://github.com/dfilatov/vidom).

## Installation

```
npm i vidom-redux
```

## API

This module provides:
  * [`<Provider>`](#provider) to make store available in the component hierarchy below
  * [`connect`](#connect) to connect arbitrary Vidom component to a Redux store

### Provider

Provider expects `store` attribute to be passed.
```jsx
import { mount } from 'vidom';
import { createStore } from 'redux';
import { Provider } from 'vidom-redux';
import App from './components/App';
import reducer from './reducers';

const store = createStore(reducer);

mount(
    document.getElementById('root'),
    <Provider store={ store }>
        <App/>
    </Provider>);
```

### connect

`connect` wraps and connects given component to a new one which is connected to a store.

  * *[{Function(storeState, ownAttrs): Object}]* `storeStateToAttrs` maps store state to attributes of wrapped component 
  * *[{Object}]* `actionCreators` action creators to be bound to store

It returns a function to wrap given component.

```js
import { Component } from 'vidom';
import { connect } from 'vidom-redux';
import * as actions from '../actions';

class MyComponent extends Component {
    ...
}

const storeStateToAttrs = ({ subState1, subState2 }) => ({ subState1, subState2 }),
    MyConnectedComponent = connect(storeStateToAttrs, actions)(MyComponent);

```

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