inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[리뉴얼] React로 NodeBird SNS 만들기

리렌더링 이해하기

hook error 입니다..

797

bklove4488

작성한 질문수 3

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에서 임시로 로그인하는게 아니라 직접비교가 어렵습니다.. 
 

react nodejs redux express Next.js

답변 2

1

제로초(조현영)

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

0

bklove4488

답변감사합니다.

아래 userprofile입니다.

문제가있을까요? 

 

0

제로초(조현영)

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

0

bklove4488

Terminal 상 오류와 

크롬 오류보내드립니다!

0

bklove4488

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)

0

제로초(조현영)

npm i styled-components@4

해서 버전을 낮춰보세요.

0

bklove4488

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

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

 

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

0

제로초(조현영)

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

0

bklove4488

:) 

넥스트 버젼 질문

0

77

2

로그인시 401 Unauthorized 오류가 뜹니다

0

89

1

무한 스크롤 중 스크롤 튐 현상

0

175

1

특정 페이지 접근을 막고 싶을 때

0

103

2

createGlobalStyle의 위치와 영향범위

0

96

2

인라인 스타일 리렌더링 관련

0

91

2

vsc 에서 npm init 설치시 오류

0

146

2

nextjs 15버전 사용 가능할까요?

0

158

1

화면 새로고침 문의

0

121

1

RTK에서 draft, state 차이가 있나요?

0

153

2

Next 14 사용해도 될까요?

0

452

1

next, node 버전 / 폴더 구조 질문 드립니다.

0

349

1

url 오류 질문있습니다

0

211

1

ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out

0

372

1

sudo certbot --nginx 에러

0

1274

2

Minified React error 콘솔에러 (hydrate)

0

470

1

카카오 공유했을 때 이전에 작성했던 글이 나오는 버그

0

247

1

프론트서버 배포 후 EADDRINUSE에러 발생

0

327

1

npm run build 에러

0

518

1

front 서버 npm run build 중에 발생한 에러들

0

381

1

서버 실행하고 브라우저로 들어갔을때 404에러

0

338

2

css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.

0

287

1

팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.

0

237

2

해시태그 검색에서 throttle에 관해 질문있습니다.

0

201

1