리액트 리덕스 에러해결 Error: Reducer "user" returned undefined during initialization. If the state passed to the reducened. If you don't want to set a value for this reducer, you can use null instead of undefined.

leehyunju·2021년 7월 5일
0

Error: Reducer "user" returned undefined during initialization. If the state passed to the reducened. If you don't want to set a value for this reducer, you can use null instead of undefined.

이러한 에러가 발생했을 경우,

이렇게 user의 초기상태를 선언해 줘야 한다.


const initialState = {
  user: {
    isLoggingIn: true,
    data: null,
  },
  posts: [],
};
profile
아늑한 뇌공간 🧠

0개의 댓글