This module provides ability to define actors with Redux. Actors are functions that handle changes in state and perform actions, including dispatching another Action.
npm install --save redux-actors
or yarn add redux-actors
import { createStore } from 'redux'
import subscribe from 'redux-actors'
const myStore = createStore(reducer)
let actors = (state, dispatch) => {
if (state.field) {
dispatch(SOME_ACTION)
}
}
const actorFunction = (state, dispatch) => {
// handle state and do something
}
actors = {
statePart (state, dispatch) {
// handle state
}
anotherStatePart: actorFunction
}
const unsibscribe = subscribe(store, actors)
MIT © Arosii A/S © Alexey Shildyakov