[React Native] Warning: React.jsx: type is invalid -- expected a string, [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. 에러 해결

oojaeje·2023년 9월 7일

ReactNative

목록 보기
1/1
post-thumbnail

처음 배우는 리액트 네이티브 (한빛미디어, 김범준) 를 공부하던 중 5장 할 일 관리 애플리케이션에서 이런 에러를 맞닥뜨렸다...

ERROR  Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `App`.
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)세요

import한 패키지 중 오류가 난 것 같은데 도저히 어디서 났는지 감이 안와서 AsyncStorage만 한참 건드리다 혹시? 하고 AppLoading 패키지를 구글링 해보니 이런 글을 발견했다.
[React Native] AppLoading 컴포넌트 에러
덕분에 해결했다!!!

또 AsyncStorage는 책에서 react-native-community/async-storage를 사용했는데, 이러한 오류가 나서 (이거 때문인지 확실하지는 않다)

[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

챗지피티에 물어보니 대신 eact-native-async-storage/async-storage를 사용하라고 하길래 그렇게 했더니 고쳐졌다.

리액트 네이티브는 참 디버그가 힘든 것 같다...
내 역량 부족이겠지..! 열심히 하자...😇🫠

2개의 댓글

comment-user-thumbnail
2024년 4월 10일

열심히 파이팅 하세요!!!!

1개의 답글