0.0.23 • Published 5 years ago
@mitod/mitod-redux v0.0.23
constraint
基于redux 集成了redux-saga的封装
目录
src
- models (写法详见Models)
- - index.ts
- - xxxx.ts
- pages
- - app.tsx
- - xxx.tsx
- services
- - auth.ts
使用
import { Config, Root } from '@mitod/mitod-redux/src';
import Setup from './src/index';
import models from './src/model';
const store = Config({
models,
dev: __DEV__,
});
const App = () => {
return (
<Root store={store}>
<Setup />
</Root>
);
};
export default App;
Models
export default {
namespace: 'app',
state: {
login: false,
loading: true,
fetching: false
},
reducers: {
updateState(state, { payload }) {
return { ...state, ...payload };
}
},
effects: {
*loadStorage(action, { ...redux-saga }) {
yield 'test';
}
}
};
dispatch
// 1. reducer
dispatch({
type:'aaaa.reducers/bbbb'
})
// 2. effect
dispatch({
type:'aaaa.effects/bbbb'
})
// 3. 取消task
dispatch({
type:'aaaa.effects/bbbb@@cancel'
})
0.0.23
5 years ago
0.0.22
5 years ago
0.0.21
5 years ago
0.0.20
5 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.16
5 years ago
0.0.15
5 years ago
0.0.14
5 years ago
0.0.13
5 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago