Export 'getDefaultMiddleware' (imported as 'getDefaultMiddleware') was not found in '@reduxjs/toolkit'

if ever you encounter this. it could be fix using this line of code.

import { configureStore } from “@reduxjs/toolkit”;
import reducer from “./reducer”;
import logger from “./middleware/logger”;
import toast from “./middleware/toast”;
import api from “./middleware/api”;

export default function () {
return configureStore({
reducer,
middleware: (getDefaultMiddleware) => [
…getDefaultMiddleware(),
logger({ destination: “console” }),
toast,
api,
],
});
}

1 Like