@rematch2/redux-observable
TypeScript icon, indicating that this package has built-in type declarations

0.2.1-alpha.0 • Public • Published

rematch-observable

Version License: MIT Twitter: jiangweixian

redux-observable in rematch

Setup

npm install rematch-observable --save

Usage

see more in example

// import
import { init, RematchRootState, RematchDispatch } from '@rematch/core'

// setup plugin
const rematchObservable = createRematchObservable({ epics: { sharkEpics }, models })

export const store = init({
  models,
  plugins: [rematchObservable],
})

// types
export type Dependencies = RematchObserverDependencies<Dispatch>

// epics
import { RematchEpic, ofType } from 'rematch-observable'
import { mapTo } from 'rxjs/operators'
import { RootState, Dependencies } from 'src/store'

export const sharkEpics: RematchEpic<RootState, Dependencies> = (
  action$,
  state$,
  { dispatchers },
) => {
  return action$.pipe(
    ofType(dispatchers.dolphins.increment, dispatchers.dolphins.incrementAsync),
    mapTo(dispatchers.sharks.increment(1)),
  )
}

Author

👤 JiangWeixian

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

Package Sidebar

Install

npm i @rematch2/redux-observable

Weekly Downloads

0

Version

0.2.1-alpha.0

License

none

Unpacked Size

94.7 kB

Total Files

8

Last publish

Collaborators

  • jiangweixian1994