Lightweight version of the redux library.
npm install -S @jswork/next-redux-lite
api | args | description |
---|---|---|
INIT_TYPE | - | @@redux/INIT_0.g5t24hclwrt |
create | reducers, initialState, enhancer | Create store. |
apply | middleware1,middleware2... | Apply middlewares. |
getState | - | redux.getState |
subscribe | listener | redux.subscribe |
dispatch | action | redux.dispatch |
import NxReduxLite from '@jswork/next-redux-lite';
// create a redux store:
const store = NxReduxLite.create(reducers, {
test: 123
});
// subscribe the store:
store.subscribe(()=>{
console.log('get!')
});
// dispath:
store.dispatch({
type:'INC',
data: 1
});
// get latest state:
store.getState();
Code released under the MIT license.