해결된 질문
작성
·
676
·
수정됨
0
이 에러는 왜 발생한 건가요?
구글에 검색도 해봤는데 안나오네요
도와주세요 ㅠ
reducers/user.js 코드입니다
export const initialState = {
}
export const loginAction = (data) => {
return {
type: 'LOG_IN',
data,
}
}
export const logoutAction = () => {
return {
type: 'LOG_OUT',
}
}
const reducer = (State = initialState, action) => {
switch (action.type) {
case 'LOG_IN': {
return {
...state,
isLoggedIn: true,
user: action.data,
};
}
case 'LOG_OUT': {
return {
...state,
isLoggedIn: false,
user: null,
};
}
default:
return state;
}
};
export default reducer;
터미널창 오류 메세지 입니다
error - reducers/user.js (37:12) @ reducer
error - ReferenceError: state is not defined
at reducer (webpack-internal:///./reducers/user.js:39:13)
at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:476:24
at Array.forEach (<anonymous>)
at assertReducerShape (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:474:25)
at combineReducers (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:539:5)
at eval (webpack-internal:///./reducers/index.js:15:75)
at Object../reducers/index.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:33:1)
at __webpack_require__ (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./store/configureStore.js:9:67)
at Object../store/configureStore.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:66:1) {
page: '/'
}
35 | }
36 | default:
> 37 | return state;
| ^
38 |
39 | }
40 | };
event - compiled client and server successfully in 100 ms (1518 modules)
4. WrappedApp created new store with withRedux(NodeBird) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
ReferenceError: state is not defined
at reducer (webpack-internal:///./reducers/user.js:39:13)
at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:476:24
at Array.forEach (<anonymous>)
at assertReducerShape (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:474:25)
at combineReducers (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:539:5)
at eval (webpack-internal:///./reducers/index.js:15:75)
at Object../reducers/index.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:33:1)
at __webpack_require__ (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./store/configureStore.js:9:67)
at Object../store/configureStore.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:66:1)
http://localhost:3060 에 뜬 오류 입니다
ReferenceError: state is not defined
This error happened while generating the page. Any console logs will be displayed in the terminal window.
reducers/user.js (35:12) @ reducer
33 | }
34 | default:
> 35 | return state;
| ^
36 |
37 | }
38 | };
죄송합니다 ㅠㅠ 수정했어요
도와주세요