# redux-jetpack

> Helpers for Boilerplate-free Redux

Latest version **1.0.2** (published 2021-03-28) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-03-28 |
| First published | 2017-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jeswin |
| Maintainers | jeswin |

## Links

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

## Dependencies (6)

- [react](https://npm.io/package/react.md) ^16.8.6
- [redux](https://npm.io/package/redux.md) ^4.0.1
- [react-redux](https://npm.io/package/react-redux.md) ^7.0.2
- [@types/react](https://npm.io/package/@types/react.md) ^16.8.13
- [@types/redux](https://npm.io/package/@types/redux.md) ^3.6.0
- [@types/react-redux](https://npm.io/package/@types/react-redux.md) ^7.0.6

## Recent versions

- 1.0.2 (latest) — 2021-03-28
- 1.0.1 — 2019-04-15
- 1.0.0 — 2019-04-15
- 0.0.14 — 2018-03-09
- 0.0.13 — 2018-03-09
- 0.0.12 — 2018-03-07
- 0.0.11 — 2018-03-07
- 0.0.10 — 2018-03-07
- 0.0.9 — 2018-02-23
- 0.0.8 — 2018-02-23
- 0.0.7 — 2018-02-23
- 0.0.6 — 2018-02-23
- 0.0.5 — 2018-02-21
- 0.0.4 — 2018-01-25
- 0.0.3 — 2018-01-24
- … 2 more at https://npm.io/package/redux-jetpack/versions

## README

# redux-jetpack

Helpers for Boilerplate-free Redux

Based on ["Implementing Redux is tedious. But it doesn’t have to be."](https://medium.com/@jeswin/implementing-redux-is-tedious-but-it-doesnt-have-to-be-33702a1fb1dd)

### Install

```
npm install redux-jetpack
```

### Usage

Here is an example.

```js
  /*
    This is the shape of your store's state
  */

  type State = {
    networks: { type: string; count: number }[];
    user: {
      name: string;
    };
  };

  const initialState: State = {
    networks: [
      { type: "ssb", count: 1000 },
      { type: "ipfs", count: 100 },
      { type: "dat", count: 10 }
    ],
    user: {
      name: "jeswin"
    }
  };

  /* Create the store */
  const store = jetpack.createStore(initialState);

  /* Your component */
  const MyComponent = (props: {
    id: number;
    location: string;
    name: string;
  }) => (
    <div>
      <h1>
        Hello {props.name} ({props.location}, {props.id})
      </h1>
    </div>
  );

  /* Connect the component to the store */
  const Wrapped = jetpack.connect(MyComponent, (state: State) => state.user);

  /* Wrap component in redux's Provider, you're ready to go. */
  const App = (
    <Provider store={store.reduxStore}>
      <Wrapped id={10} location="blr" />
    </Provider>
  );

  /* Enzyme test */
  const doc = mount(App) as any;
  doc
    .render()
    .find("h1")
    .should.have.text("Hello jeswin (blr, 10)");
```

For more examples, see [the tests](https://github.com/jeswin/redux-jetpack/blob/master/src/test/test.tsx)

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