在 React Redux 中使用减速器(combineReducers)

Using reducer (combineReducers) in React Redux

我正在尝试在 React redux 中使用 combineReducers,但我一直在控制台中收到此错误。

"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers

store.js

import { configureStore } from "@reduxjs/toolkit";
import { combineReducers } from "redux";

const reducer = combineReducers({});

const initialState = {};

const store = configureStore(reducer, initialState);

export default store;

documentation 中所述,您必须将具有多个方法的对象作为属性传输到 combinereducers。这些方法就是减速器。

为简单起见,您传输到 combineReducers 的对象必须仅包含具有描述的签名的方法的对象 here