Frontend
redux error - A non-serializable value was detected in an action, in the path 해결 방법
헬롤이다
2023. 6. 9. 15:41
- 참고 링크
Getting an error "A non-serializable value was detected in the state" when using redux toolkit - but NOT with normal redux
I am trying to switch an app I am building over to use Redux Toolkit, and have noticed this error coming up as soon as I switched over to configureStore from createStore: A non-serializable value ...
stackoverflow.com
Redux Toolkit - A non-serializable value was detected in an action, in the path: `type` 오류 해결
리덕스 강의 과제를 따라하다가 아래와 같은 오류와 직면했다. 오류 내용을 천천히 읽어 보면 action에 직렬화가 불가능한 값을 전달했다는 뜻으로 해석할 수 있다. 여기서 직렬화란 redux에서 값
guiyomi.tistory.com
export const store = configureStore({
reducer: {
locationReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: false,
}),
});
middleware를 추가해준다.
에러 원인
Redux Toolkit에서 자동으로 생성해 주는 action 객체는 action 생성자 함수 형태이기 때문이다. type의 인자로 string 값이 전달되어야 하는데 함수가 전달돼서 오류가 발생한 것이다.