I'm trying to set up redux with connected-react-router, but I didn't really understand how to do that, I'm using the create-react-app --template redux, but if I try to do that  I get the following error: Uncaught Error: Actions must be plain objects. Use custom middleware for async actions.
   import { configureStore, combineReducers } from "@reduxjs/toolkit";
    import { connectRouter, routerMiddleware } from "connected-react-router";
    import { createBrowserHistory } from "history";
    import homePageSlice from "./reducers/homepage/homePageSlice";
    
    export const history = createBrowserHistory();
    
    
    export const store = configureStore({
      reducer: {
        router: connectRouter(history),
        homepage: homePageSlice,
      },
      middleware: [routerMiddleware(history)],
    });
                setting middleware property will override the default middleware that configureStore injects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With