이때 생긴 문제는 바로!
history를 import할때 {history}라고 안해서 생긴 에러다.
redux >
configStore.js
import { createStore, applyMiddleware, compose, combineReducers } from "redux";
import { createBrowserHistory } from "history";
import { connectRouter } from "connected-react-router";
import thunk from "redux-thunk";
import item from "./modules/item";
import cart from "./modules/cart";
const history = createBrowserHistory();
const rootReducer = combineReducers({
item,
cart,
router: connectRouter(history),
});
const middlewares = [thunk.withExtraArgument({ history })];
const env = process.env.NODE_ENV;
if (env === "development") {
const { logger } = require("redux-logger");
middlewares.push(logger);
}
const composeEnhancers =
typeof window === "object" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
})
: compose;
const enhancer = composeEnhancers(applyMiddleware(...middlewares));
const store = createStore(rootReducer, enhancer);
export { history };
export default store;
728x90
'에러노트' 카테고리의 다른 글
[에러노트] No overload matches this call. (0) | 2021.11.24 |
---|---|
[에러노트] Dependency cycle via @/router/index:3 (0) | 2021.11.22 |
[에러노트] react-scripts 은(는) 내부 또는 외부 명령 실행할 수 있는 프로그램 또는 배치 파일이 아닙니다 (0) | 2021.10.06 |
[에러노트] npm ERR! Cannot read property 'match' of undefined (0) | 2021.10.06 |
[에러코드] Error: Too many re-renders. React limits the number of renders to prevent an infinite loop. (0) | 2021.09.29 |