Skip to content

lronhoj/redux-actors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published