没有简化器为“管理”规定。 React Admin错误
我在反应添加面板中使用redux。我正在关注文档,包括另一个Redux中的React-Admin应用程序
但是我会遇到此错误。
没有为密钥“ admin”提供减少
我认为 admindreducer 无法从“ react-admin”中导入。我在升级我的错误后面临此错误React Admin从3.18到4.0.0。它与版本不匹配有关吗?
在这里,我的 createadminstore.js
import { applyMiddleware, combineReducers, compose, createStore } from "redux";
import { routerMiddleware, connectRouter } from "connected-react-router";
import createSagaMiddleware from "redux-saga";
import { all, fork } from "redux-saga/effects";
import { adminSaga, adminReducer, USER_LOGOUT } from "react-admin";
export default ({ authProvider, dataProvider, history }) => {
const reducer = combineReducers({
admin: adminReducer,
router: connectRouter(history),
// add your own reducers here
});
const resettableAppReducer = (state, action) =>
reducer(action.type !== USER_LOGOUT ? state : undefined, action);
const saga = function* rootSaga() {
yield all(
[
adminSaga(dataProvider, authProvider),
// add your own sagas here
].map(fork)
);
};
const sagaMiddleware = createSagaMiddleware();
const composeEnhancers =
(process.env.NODE_ENV === "development" &&
typeof window !== "undefined" &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
trace: true,
traceLimit: 25,
})) ||
compose;
const store = createStore(
resettableAppReducer,
{
/* set your initial state here */
},
composeEnhancers(
applyMiddleware(
sagaMiddleware,
routerMiddleware(history)
// add your own middlewares here
)
// add your own enhancers here
)
);
sagaMiddleware.run(saga);
return store;
};
I am using redux in my react-admin panel. I am following the document Including React-Admin In Another Redux Application
But I get this error.
No reducer provided for key "admin"
I think adminReducer can not import from "react-admin".I faced this error after upgrading my react admin from 3.18 to 4.0.0. Is it related to version mismatch?
Here my createAdminStore.js
import { applyMiddleware, combineReducers, compose, createStore } from "redux";
import { routerMiddleware, connectRouter } from "connected-react-router";
import createSagaMiddleware from "redux-saga";
import { all, fork } from "redux-saga/effects";
import { adminSaga, adminReducer, USER_LOGOUT } from "react-admin";
export default ({ authProvider, dataProvider, history }) => {
const reducer = combineReducers({
admin: adminReducer,
router: connectRouter(history),
// add your own reducers here
});
const resettableAppReducer = (state, action) =>
reducer(action.type !== USER_LOGOUT ? state : undefined, action);
const saga = function* rootSaga() {
yield all(
[
adminSaga(dataProvider, authProvider),
// add your own sagas here
].map(fork)
);
};
const sagaMiddleware = createSagaMiddleware();
const composeEnhancers =
(process.env.NODE_ENV === "development" &&
typeof window !== "undefined" &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
trace: true,
traceLimit: 25,
})) ||
compose;
const store = createStore(
resettableAppReducer,
{
/* set your initial state here */
},
composeEnhancers(
applyMiddleware(
sagaMiddleware,
routerMiddleware(history)
// add your own middlewares here
)
// add your own enhancers here
)
);
sagaMiddleware.run(saga);
return store;
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论