client/mystackoverflow 3

[error] TypeError: middleware is not a function

# 내용 redux의 히스토리를 chrome debugging tool로 보려고 하던 중 오류 발생함 redux-devtools-extension를 설치하고 redux의 createStore에 enhancer를 정의하여 넘겨 주었으나 오류 남 Server Error TypeError: middleware is not a function # 원인 아래 코드에서 applyMiddleware에 배열을 직접 넣어주어 나는 에러 const enhancer = process.env.NODE_ENV === 'production' ? compose(applyMiddleware([])) : ... 참고로 applyMiddleware 함수 정의가 아래와 같다. export function applyMiddleware( ...

[error] TypeError: Cannot read property 'isLoggedIn' of undefined (feat. redux initialState )

# 내용 redux 에 initialState 선언 후 컴포넌트에서 사용시 아래와 같은 오류가 남 (아래 소스 참고) Server Error TypeError: Cannot read property 'isLoggedIn' of undefined # 원인 redux 용 reducer 처리를 잘못했다. 최초에 초기화 할 때 root reducer가 실행되는데 이때 default 가 수행 되며, state를 반환해주어야 undefined 가 발생하지 않는다. (state = initialState) # 해결법 const rootReducer = (state = initialState, action) => { switch (action.type){ case HYDRATE: ... default: // retur..

[warning] Prop `className` did not match. 원인 및 해결법

# 내용 nextjs 에서 styled-components 사용 중 발생한 오류 내용 그대로 클래스 명이 맞지 않아서 생긴 오류 Warning: Prop `className` did not match. Server: "ant-input-group-wrapper ant-input-search ant-input-search-with-button sc-hKwDye jIYbso" Client: "ant-input-group-wrapper ant-input-search ant-input-search-with-button sc-gsDKAQ dxgLeb" # 원인 nextjs 는 최초 렝더링을 서버가 담당함 (SSR) > 최초에 서버에서 해시+클래스명으로 생성함 이후 클라이언트에서 렌더링 수행함 (CSR) > 이후 ..