76
Lightweight (300 lines) wrapper of React + Redux + Router + saga for SPA development.
Install
npm i -S 76
Usage
; const app = 'test-app'; const module = 'user-list' initialState selectors reducers watchers; app; app; appstart'#web-container' { console; }
How to write initialState
, selectors
, reducers
, watchers
of module?
initialState
initialState
is the initial state of module, used to initial store of redux. It is a pure object.
const initialState = domain: users: ui: loading: false ;
selectors
selectors
is used to select the data of module state.
const selectors = statedomainusers;
reducers
reducers
is a pure function transform old state to new state.
const reducers = { // use immutable-helper return ; } ...;
watchers
watchers
is the redux action with side-effect, see document of redux-saga.
const watchers = take: 'takeEvery' actions: 'addUserAsync' { // do something with effects. };
TODO
- Project website developed by 76.
License
ISC@hustcc.