小编Man*_*oux的帖子

错误:期望根减速器是一个函数。相反,收到:“未定义”

我一直遇到这个错误!

错误:期望根减速器是一个函数。相反,收到:“未定义”

我已经尝试了所有我能找到的答案都无济于事,这里是所有相关的东西!

根减速机

const createRootReducer = (history) => {
      combineReducers({
        router: connectRouter(history),
        createUser: signupReducer,
      });
    };

    export default createRootReducer;
Run Code Online (Sandbox Code Playgroud)

const Root = ({ children, initialState = {} }) => {
  const history = createBrowserHistory();
  const middleware = [thunk, routerMiddleware(history)];

  const store = createStore(rootReducer(history), initialState, applyMiddleware(...middleware));

  return (
    <Provider store={store}>
      <ConnectedRouter history={history}>{ children }</ConnectedRouter>
    </Provider>
  );
};

export default Root;
Run Code Online (Sandbox Code Playgroud)

应用程序

function App() {
  return (
    <div className="App">
      <Root>
        <ToastContainer hideProgressBar={true} newestOnTop={true} />
        <Navbar />
        <Landing />
        <PostList /> …
Run Code Online (Sandbox Code Playgroud)

thunk reactjs redux react-redux

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

react-redux ×1

reactjs ×1

redux ×1

thunk ×1