인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

shafeel2님의 프로필 이미지
shafeel2

작성한 질문수

처음 배우는 리액트 네이티브

아래 에러의 원인을 못찾겠네요 ,,,

작성

·

2.7K

0

https://github.com/dongguntechnology/rn_chat
 
 
17:20
Invariant Violation: "main" has not been registered. This can happen if: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project. * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
 
 
rror: 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://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

답변 1

0

김범준님의 프로필 이미지
김범준
지식공유자

안녕하세요 shafeel2 님, 

  

https://github.com/dongguntechnology/rn_chat/blob/5b0849/screens/ChannelList.js#L61

Hook은 함수 컴포넌트 안에서 호출해야 합니다. 

참고: https://ko.reactjs.org/docs/hooks-rules.html

61line을 let channels = []; 로 변경하세요

  

즐거운 하루 되세요

감사합니다.

shafeel2님의 프로필 이미지
shafeel2

작성한 질문수

질문하기