redux-actors

1.0.1 • Public • Published

This module provides ability to define actors with Redux. Actors are functions that handle changes in state and perform actions, including dispatching another Action.

Install

npm install --save redux-actors or yarn add redux-actors

Usage

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)

LICENSE

MIT © Arosii A/S © Alexey Shildyakov

/redux-actors/

    Package Sidebar

    Install

    npm i redux-actors

    Weekly Downloads

    13

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • ashl1
    • lkr_