just like
redux
but tiny
This little module mimics the redux
API, is written in vanilla JS, and has minimal dependencies and dev dependencies.
Because this module aims to be a drop-in replacement for redux, you can read the redux docs for detailed usage examples and API reference.
Usage of minidux is identical to redux:
var createStore = require('minidux').createStore
function reducer (state, action) {
if (action.type === 'example') {
return { example: true }
}
}
var store = createStore(reducer, {
example: false
})
store.subscribe(function (state) {
console.log(state)
})
store.dispatch({ type: 'example' })
If you'd like to use applyMiddleware
, bindActionCreators
, combineReducers
, createStore
, & compose
separately, you can require
those files directly:
var applyMiddleware = require('minidux/applyMiddleware')
var bindActionCreators = require('minidux/bindActionCreators')
var combineReducers = require('minidux/combineReducers')
var createStore = require('minidux/createStore')
var compose = require('minidux/compose')
Full redux docs for createStore
Full redux docs for store.getState
Full redux docs for store.dispatch
Full redux docs for store.subscribe
Full redux docs for store.replaceReducer
Full redux docs for combineReducers
Full redux docs for applyMiddleware
Full redux docs for bindActionCreators
Instead of implementing another compose
function we use the [composite](http://npmjs.com/composite)
module.
Notice any incompatibilites with redux
? Let us know in the issues queue.
- hxdx – connects a
redux
-style store to avirtual-dom
-style view - send-action – a state container with an API that is much simpler than redux, but that follows a similar pattern
- store-emitter – a state container with an API similar to redux with more flexible options for listening to changes
- prior art – some of the projects that redux is based on