• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

type error 가뜨는데 원인을 잘 모르겠어요.

20.08.28 18:20 작성 조회수 179

0

로그인 버튼 클릭 시 아래 오류가 뜨는데 어디가 문제일까요.?
index.js:43 은 입니다.

const rootReducer = (state = initialStateaction=> {
  switch (action.type) {
    case HYDRATE:
      console.log("HYDRATE"action);
      return { ...state, ...action.payload };
    case LOG_IN:
      return {
        ...state,
        user: {
          user: dummyUser,
          isLoggedIn: true,
          loginData: action.data,
          // user: action.data,
        },
      };
    case LOG_OUT:
      return {
        ...state,
        user: {
          ...state.user,
          isLoggedIn: false,
          user: null,
        },
      };
    default:
      return state;
  }
};

 
ㅡㅡㅡㅡ
useForm.js:751 TypeError: Cannot read property 'type' of undefined
    at rootReducer (index.js:43)
    at LoginForm.js:24
    at onFinish (Form.js:77)
    at useForm.js:748
ㅡㅡㅡㅡ

답변 4

·

답변을 작성해보세요.

1

Insu Seo님의 프로필

Insu Seo

질문자

2020.08.28

선생님 해결했습니다.. 액션을 가져올 때  {  }  없이 그냥 가져와서 오류가 난 것 같아요.
import { loginAction } from "../reducers/index";

0

6강에서 해결합니다

0

Insu Seo님의 프로필

Insu Seo

질문자

2020.08.28

+ 추가로  콘솔창에 이런 오류가 떠있는데 무시하면되는걸까요? 
Warning: Prop `className` did not match. Server: "ant-input-search sc-AxmLO bcIYUP ant-input-search-enter-button ant-input-group-wrapper" Client: "ant-input-search sc-AxiKw ljUZQI ant-input-search-enter-button ant-input-group-wrapper"

    in span (created by ClearableLabeledInput)

    in ClearableLabeledInput (created by Context.Consumer)

    in Input (created by Context.Consumer)

    in Search (created by Styled(Search))

    in Styled(Search) (at AppLayout.js:30)

    in li (created by MenuItem)

    in MenuItem (created by Connect(MenuItem))

    in Connect(MenuItem) (created by Trigger)

    in Trigger (created by ForwardRef(Tooltip))

    in ForwardRef(Tooltip) (created by Tooltip)

    in Tooltip (created by Context.Consumer)

    in MenuItem (at AppLayout.js:29)

    in ul (created by DOMWrap)

    in DOMWrap (created by SubPopupMenu)

    in SubPopupMenu (created by Connect(SubPopupMenu))

    in Connect(SubPopupMenu) (created by Menu)

    in Provider (created by Menu)

    in Menu (created by Context.Consumer)

    in InternalMenu (created by Context.Consumer)

    in Menu (at AppLayout.js:18)

    in div (at AppLayout.js:17)

    in AppLayout (at pages/index.js:11)

    in Home (at _app.js:14)

    in NodeBird (created by withRedux(NodeBird))

    in Provider (created by withRedux(NodeBird))

    in withRedux(NodeBird)

    in ErrorBoundary (created by ReactDevOverlay)

    in ReactDevOverlay (created by Container)

    in Container (created by AppContainer)

    in AppContainer

    in Root

0

login 버튼 클릭 코드를 보여주세요. action이 undefined라고 나오네요.