항해99/TIL

에러 마주하기

하로이 2022. 11. 2. 03:59

서버 배포가 되었고, 에러를 무진장 해결하기만 하면 되는 시간이었다. 

일단 오늘의 에러의 원인과 해결점은 아래와 같고, 모듈 없다는 오류는 yarn install로 다 해결했다.

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

 

원인 : components의 이름이 잘못되었거나, import path가 잘못 입력되었을때 발생한다. 페이지에 들어가는 컴포넌트 함수를 만들지 않고, 메인페이지에서 렌더시켰더니 발생했다.

 

해결책 : 임포트된 파일의 경로와 이름을 하나하나 확인하기, 혹시 함수가 만들어지지않은 빈페이지를 연결한건 아닌지 확인하기

 

 

Uncaught Error: Objects are not valid as a React child
(found: object with keys {id, Follow}).
If you meant to render a collection of children, use an array instead.

원인 : Object데이터를 그대로 렌더링 하려고 했기 때문에 에러가 발생한 것이라고 해서 

해결책 : axios를  return 위로 올리니까 되었음

  useEffect(() => {
    axios
      .get("http://hi-prac.shop:3000/api/count")
      .then((res) => setHome(res.data.data));
  }, []);

 

'항해99 > TIL' 카테고리의 다른 글

프로세스와 스레드의 차이점  (0) 2023.01.13
로그인 토큰 저장  (0) 2022.11.28
항해 5주차(주특기 숙련주차)-1  (0) 2022.10.19
서버리스란?  (0) 2022.10.09
Virtual DOM 왜 리액트에서 이걸 쓸까?  (0) 2022.10.09