@jsar/mobx-saga
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

MobX Saga

A bridge between Redux-Saga and MobX

$ npm install @jsar/mobx-saga

Getting Started

import { createMobXSaga } from '@jsar/mobx-saga'
import rootStore from './rootStore'

const saga = createMobXSaga({
  store: rootStore
})

saga.run(function *rootSaga() {
  ...
})

// Action Dispatcher
saga.dispatch(myAction)

commit Effect

import { commit, type Mutation } from "@jsar/mobx-saga";
import type { RootStore } from "./rootStore";

type RootStore = { value: number };

const increment: Mutation<RootStore, [number]> = (store, inc) => {
  store.value += inc;
};

function* incSaga() {
  yield commit(increment, 1);
}

Readme

Keywords

none

Package Sidebar

Install

npm i @jsar/mobx-saga

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

25.8 kB

Total Files

8

Last publish

Collaborators

  • johan-ar