• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

hook error 입니다..

21.11.25 00:01 작성 조회수 458

0

안녕하세요 제로초님!
 
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
 
가 뜨는데 도통 문제가 뭔지 모르겠네요...
 
Git 을 참고하려했으나
완성본에는 front에서 임시로 로그인하는게 아니라 직접비교가 어렵습니다.. 
 

답변 2

·

답변을 작성해보세요.

1

UserProfile 코드도 한 번 봐보시겠어요? return이 use보다 더 위에있거나 하면 안 됩니다.

0

bklove4488님의 프로필

bklove4488

질문자

2021.11.25

답변감사합니다.

아래 userprofile입니다.

문제가있을까요? 

 

올려주신 코드에는 문제가 없네요. 정확한 에러메시지 전체를 올려주세요. 거기에 에러가 나는 위치나 컴포넌트명이 나와있을 겁니다.

bklove4488님의 프로필

bklove4488

질문자

2021.11.25

Terminal 상 오류와 

크롬 오류보내드립니다!

bklove4488님의 프로필

bklove4488

질문자

2021.11.25

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

1. You might have mismatching versions of React and the renderer (such as React DOM)

2. You might be breaking the Rules of Hooks

3. You might have more than one copy of React in the same app

See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

    at resolveDispatcher (C:\Users\USER\JavaScript\nodebird\node_modules\react\cjs\react.development.js:1465:13)

    at Object.useDebugValue (C:\Users\USER\JavaScript\nodebird\node_modules\react\cjs\react.development.js:1529:22)

    at C:\Users\USER\JavaScript\nodebird\node_modules\styled-components\dist\styled-components.cjs.js:1:18275

    at Object.I [as render] (C:\Users\USER\JavaScript\nodebird\node_modules\styled-components\dist\styled-components.cjs.js:1:19220)

    at ReactDOMServerRenderer.render (C:\Users\USER\JavaScript\nodebird\front\node_modules\react-dom\cjs\react-dom-server.node.development.js:3535:44)

    at ReactDOMServerRenderer.read (C:\Users\USER\JavaScript\nodebird\front\node_modules\react-dom\cjs\react-dom-server.node.development.js:3373:29)

    at renderToString (C:\Users\USER\JavaScript\nodebird\front\node_modules\react-dom\cjs\react-dom-server.node.development.js:3988:27)

    at Object.renderPage (C:\Users\USER\JavaScript\nodebird\front\node_modules\next\dist\next-server\server\render.js:50:851)

    at Function.getInitialProps (C:\Users\USER\JavaScript\nodebird\front\.next\server\pages\_document.js:299:19)

    at loadGetInitialProps (C:\Users\USER\JavaScript\nodebird\front\node_modules\next\dist\next-server\lib\utils.js:5:101)

npm i styled-components@4

해서 버전을 낮춰보세요.

bklove4488님의 프로필

bklove4488

질문자

2021.11.25

잘되네요 ㅎㅎ 감사합니다. 

오늘 node교과서도 구매했습니당ㅎ ㅎㅎ

 

혹시 어느부분보고 버전 문제인지 아셨을까요??

저 에러로 구글링 해서 찾았습니다. 책 구매 감사합니다~

bklove4488님의 프로필

bklove4488

질문자

2021.11.25

:)