rematch-observable
v1.0.1
Published
<h1>rematch-observable</h1> <p> <img alt="Version" src="https://img.shields.io/github/package-json/v/jiangweixian/rematch-observable?label=rematch-observable&logo=npm" /> <a href="#" target="_blank"> <img alt="License: MIT" src="https://img.shield
Downloads
5
Maintainers
Readme
redux-observable in rematch
if you looking for [email protected], please reference to [email protected]
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
- Twitter: @jiangweixian
- Github: @jiangweixian
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator