안녕하세요 선생님
588
작성한 질문수 5
안녕하세요 선생님! 강의 잘 듣고 있습니다.
다름아니라 제가 강의들으면서 따라 만들고 있는데요.
movien detail 페이지에서 웹은 정상적으로 잘 작동하나 콘솔창에
아래와 같은 2종류의 에러가 총 35개가 뜨는데 구글에
검색하면서 나오는 해결 방법으로 이리저리 해봤는데
잘 안되서 질문 드립니다. 어떻게 해야할까요?
---------------1번 종류
Warning: React.createElement: 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 your code at MovieInfo.js:8.
in MovieInfo (at MovieDetail.js:50)
in div (at MovieDetail.js:46)
in div (at MovieDetail.js:40)
in MovieDetail (created by Context.Consumer)
in withRouter(MovieDetail) (at auth.js:38)
in AuthenticationCheck (created by Context.Consumer)
in Route (at App.js:25)
in Switch (at App.js:21)
in div (at App.js:20)
in Suspense (at App.js:18)
in App (at src/index.js:29)
in Router (created by BrowserRouter)
in BrowserRouter (at src/index.js:28)
in Provider (at src/index.js:21)
-------------------2번 종류
Warning: Updating a style property during rerender (background) when a conflicting property is set (backgroundPosition) can lead to styling bugs. To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.
in div (at MainImage.js:5)
in MainImage (at MovieDetail.js:41)
in div (at MovieDetail.js:40)
in MovieDetail (created by Context.Consumer)
in withRouter(MovieDetail) (at auth.js:38)
in AuthenticationCheck (created by Context.Consumer)
in Route (at App.js:25)
in Switch (at App.js:21)
in div (at App.js:20)
in Suspense (at App.js:18)
in App (at src/index.js:29)
in Router (created by BrowserRouter)
in BrowserRouter (at src/index.js:28)
in Provider (at src/index.js:21)
혹시나 해서 제 깃허브 주소 첨부드립니다.
https://github.com/AyoungWon/movie-site
답변 부탁드릴게요 감사합니다.
---------------------
질문 올린뒤 계속 검색하다가 dependency 업데이트 하라는 말이 있어서
전부 최신 버전으로 업데이트 했더니 에러는 계속 나고 비슷한 warning이긴 한데
1번 종류 에러가 아래처럼 바뀌었습니다.
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 your code at MovieInfo.js:8.
2번 종류 에러도 여전히 있구요.. 웹은 일단 잘 돌아가는데 왜일까요 ㅠㅠㅠㅠ
답변 2
1
-------------------2번 종류
Warning: Updating a style property during rerender (background) when a conflicting property is set (backgroundPosition) can lead to styling bugs. To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.
이 에러는 리렌더링 될때 값이 없어도 css 속성이 렌더링 되버려서 생기는 부분이에요
그래서 강사님께서 앞에 {MainMovieImage && 로 감싸주셨고 이렇게 했는데도 같은 에러가 발생하면
useState 초기화할때 useState(null) 이렇게 쓰면 해결되요
0
useState(null) 하고 {MainMovieImage && 했는데도 error 뜨네요
Warning: Updating a style property during rerender (background) when a conflicting property is set (backgroundSize) can lead to styling bugs. To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.
at div
at MainImage (http://localhost:3000/static/js/bundle.js:781:18)
at div
at LandingPage (http://localhost:3000/static/js/bundle.js:615:78)
at AuthenticationCheck (http://localhost:3000/static/js/bundle.js:2173:81)
at Routes (http://localhost:3000/static/js/bundle.js:92612:5)
at div
at Suspense
at App
at Router (http://localhost:3000/static/js/bundle.js:92545:15)
at BrowserRouter (http://localhost:3000/static/js/bundle.js:92025:5)
at Provider (http://localhost:3000/static/js/bundle.js:89209:20)
0
// MovieDetail.js
Movie state가 null로 초기화 되었는지 확인해보세요^^
const [Movie, setMovie] = useState(null);
또한 return 할 때
{Movie && <MainImage />}
단축평가로 useEffect가 실행되어 Movie 상태가 저장 됐을때 실행되도록 하세요 :)
에러서 요렇게만 해보세요
0
228
1
antd Menu 질문
0
258
1
movieTitle
0
218
1
npm run dev 연결이 안됩니다ㅜㅜ
0
409
1
npm run dev 오류
0
853
1
403 forbidden error
0
1067
2
npm run dev 오류
0
696
1
모듈이 없다는데요
0
1276
1
npm run dev 실행시 오류
0
5365
1
504 Gateway Timeout Error
0
1448
1
컴파일 에러 관련 문의
0
504
1
npm run dev 오류
0
760
1
이미지가 안떠요...
0
369
2
npm run dev 실행하고 인증이 안되는거 같아요
0
531
1
cd client에서 npm install 오류
0
1418
1
npm run dev시 localhost가 자꾸 3000으로 연결됩니다
0
972
1
Netlify + AWS Elastic Beanstalk 를 이용한 배포
1
1785
1
[nodemon] app crashed - waiting for file changes before starting... Error occurred while proxying request localhost:3000/api/hello to http://localhost:5000/ 해결법
0
460
0
지금 듣기엔 안되는 강의일까요?
0
716
1
사진이 2개 2개씩 다른줄에 나와요 ㅠㅠ
0
428
1
비동기 처리가 영상과 다르게 됩니다..
0
245
0
#2강 npm install
0
767
4
LandingPage.js 내 useState(null) 이용하는 이유
0
223
0
client 부분에 App.js 와 Config.js 위치가 다른데 상관없는 것인가요?
0
378
1





