1. 발생 계기
기존 프로젝트에서 새로 redux 를 세팅하는 과정에서 발생하였다.
2. 탐구해본 원인
타입에러로서 store.getState 는 함수가 아니라고 한다.. 무슨 소리지. 일단 store.getStore가 어디서 나온건지 알수 없었고, 다만 store 라는 부분을 봐서 이와 연관된 부분에서 오류가 난것인가 생각이 들었다.
그래서 redux 에서 store 를 다루는 부분의 코드들을 다시 점검해보았다.
3. 해결 과정
우선 stores 폴더에 configurStore.js 를 살펴보았다.
함수 configureStore 는 반환값으로 store 를 생성한다.
그 다음 전체 컴포넌트에 store 를 적용시키기 위해 셋팅했던 index.js 를 살펴보았다.
전체 컴포넌트를 Provider 로 감싸주어 속성 store 에 store 를 넣어주려고 한다. 아, store 부분에 반환값이 아닌 함수를 넣어 버렸다.. 이제 함수를 호출하여 반환값인 store 를 넣어주도록 하자.
이렇게 변경하니 오류가 해결되었다.
'Programing > Error' 카테고리의 다른 글
Error : MySQL Sequelize 사용 중 Models 관련 오류 (0) | 2022.11.23 |
---|---|
Error : Access denied for user '유저아이디'@'localhost' (using password: YES) 해결 및 mysql 비밀번호 초기화 (0) | 2022.11.16 |
Error : because it would overwrite input file (0) | 2022.11.12 |
Error: Invalid Hook Call Warning (1) | 2022.10.29 |
Error: ERESOLVE unable to resolve dependency tree (1) | 2022.10.29 |