# rematch-saga

> Plugin to enable redux saga effects in Rematch

Latest version **1.0.1** (published 2018-12-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install rematch-saga
pnpm add rematch-saga
yarn add rematch-saga
bun add rematch-saga
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-12-15 |
| First published | 2018-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Alexey Kolpakov |
| Maintainers | alhimik45 |
| Keywords | redux, saga, rematch, @rematch, plugin |

## Links

- npm: https://www.npmjs.com/package/rematch-saga
- Repository: https://github.com/alhimik45/rematch-saga
- Homepage: https://github.com/alhimik45/rematch-saga#readme
- Issues: https://github.com/alhimik45/rematch-saga/issues
- npm.io page: https://npm.io/package/rematch-saga

## Dependencies (1)

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

## Recent versions

- 1.0.1 (latest) — 2018-12-15
- 1.0.0 — 2018-10-25

## README

# THIS PACKAGE WORKS ONLY FOR VERY SIMPLE CASES

Reasons for incomplete support described in [this comment](https://github.com/alhimik45/rematch-saga/issues/1#issuecomment-441762109). If you have any idea how to make it work, please write me.

# Rematch Saga

Redux-saga plugin for Rematch.

## Install

```
npm install rematch-saga
```

## Setup

```js
import { init } from '@rematch/core'
import sagaPlugin from 'rematch-saga'

init({
  plugins: [sagaPlugin()]
})
```

Optionally `sagaPlugin` takes `sagaMiddleware`. If it is not passed, plugin creates its own middleware.

## Using sagas

After including plugin along with async effects you can write sagas:

```js
const count = {
    state: 0,
    reducers: {
        increment(state) {
            return state + 1
        }
    },
    effects: {
        async incrementAsync() { // usual async effect
            await asyncDelay(1000)
            this.increment()
        },
        *incrementAsyncSaga() { // full-featured saga
            yield call(delay, 1000)
            yield call(this.increment)
        }
    }
}
```

Sagas are called like any other effects. See `examples/` for more information.

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