在React Redux中使用还原器(组合核)
我正在尝试在React Redux中使用组合形式,但我一直在控制台中收到此错误。
“ reducer”是必需的参数,必须是函数或对象 可以传递给组合量的功能
商店的功能
import { configureStore } from "@reduxjs/toolkit";
import { combineReducers } from "redux";
const reducer = combineReducers({});
const initialState = {};
const store = configureStore(reducer, initialState);
export default store;
I am trying to use combineReducers in React redux but i keep receiving this error in the console.
"reducer" is a required argument, and must be a function or an object
of functions that can be passed to combineReducers
the store.js
import { configureStore } from "@reduxjs/toolkit";
import { combineReducers } from "redux";
const reducer = combineReducers({});
const initialState = {};
const store = configureStore(reducer, initialState);
export default store;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如文档,您必须将具有多个方法作为属性传输到
>
组合
。这些方法是还原器。为了简单起见,您将传输到
组合量
必须是一个对象,只有具有所描述的签名在这里Like mentioned on the documentation, you must transmit an object with several method as properties to
combinereducers
. These methods are the reducers.To make it simple, what you transmit to
combineReducers
must be an object only with methods that have the signature that is described here