@jswork/next-redux-lite
v1.0.0
Published
Lightweight version of the redux library.
Downloads
5
Readme
next-redux-lite
Lightweight version of the redux library.
installation
npm install -S @jswork/next-redux-lite
apis
| 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 |
usage
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();
license
Code released under the MIT license.