我有几个reducers reducers / index.js
import { combineReducers } from 'redux';
import mainReducer from './mainReducer';
import userReducer from './userReducer';
import pageReducer from './pageReducer';
import categorieReducer from './categorieReducer';
const rootReducer = combineReducers({
mainReducer,
userReducer,
pageReducer,
categorieReducer
})
export default rootReducer
每个化简器使用一个通用状态化简器/initialStates.js
const initialState = {
//.....
}
export default initialState;
par exemple reducers / mainReducer.js
import initialState from './initialState.js'
const mainReducer = (state = initialState, action) => {
// ....
}
export default mainReducer;
redux-store.js
import {createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from "redux-devtools-extension";
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(thunk)));
export default store;
错误: enter image description here
我如何将其划分为减速器,并且每个减速器都将连接到一个公共状态。对不起我的英语