리덕스 리듀서 오류

김윤진·2022년 3월 1일
0

문제해결

목록 보기
2/9

Error: The slice reducer for key "todos" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.

오류: 초기화하는 동안 키 "todos"에 대한 슬라이스 감소기가 정의되지 않음을 반환했습니다. 감속기에 전달된 상태가 정의되지 않은 경우 초기 상태를 명시적으로 반환해야 합니다. 초기 상태는 정의되지 않을 수 있습니다. 이 감속기에 대한 값을 설정하지 않으려면 undefined 대신 null을 사용할 수 있습니다.

해결방안

이 문제는 모듈에서 리듀서를 선언할 때 default 값을 선언하지 않아 생기는 에러이다

0개의 댓글