상세 컨텐츠

본문 제목

리액트 에러 리스트 및 검토

CODING/React.js

by 뚜뚜 DDUDDU 2022. 12. 26. 16:22

본문

 

**에러 검토**

(1)
react-dom.development.js:88 Warning: Received `false` for a non-boolean attribute `transform`.
If you want to write it to the DOM, pass a string instead: transform="false" or transform={value.toString()}.
If you used to conditionally omit it with transform={condition && value}, pass transform={condition ? value : undefined} instead.

--> 예를들어 div태그의 표준속성은 (class 등) boolean값으로 들어가면 안된다 --> () ? true : not 이렇게..
--> 이럴땐, 속성명을 바꿔준다 (transform --> roll) 
--> 타입스크립트는 자바스크립트 파일로 바꿔준다.

    const  [show,  setShow]  =  useState(false);
    <Icon  roll={show}>{icon}</Icon>
    
    export  const  Icon  = styled.div`
    opacity:  1;
    transform:  ${({  roll  })  => (roll ?  'rotate(180deg)'  :  undefined)};
    transition:  all  0.4s  ease;
    cursor:  pointer;
    `;

(2)  'BasicRecords'은(는) JSX 구성 요소로 사용할 수 없습니다.  해당 반환 형식 'void'은(는) 유효한 JSX 요소가 아닙니다.ts(2786)
--> return()이 빠졌음


(3) Error:  Failed prop type: The prop `href` expects a `string` or `object` in `<Link>`, but got `undefined` instead. Open your browser's console to view the Component stack trace.
--> return()이 빠졌음.
--> 또는 a 태그에 href를 link태그로 옮겨야 함

(4) Error: Unknown column 'avatar' in 'field list' DB 생성후에...
 --> npx sequelize db:create 로 넣어줘야 함

(5) 404 error not found: 미들웨어(routes 또는 sagas 등 문제)
--> param 즉 유저명 등이 url에 있을 경우 파일 위에서부터 아래로 읽기때문에 아래로 내려주어야 함
https://www.inflearn.com/course/%EB%85%B8%EB%93%9C%EB%B2%84%EB%93%9C-%EB%A6%AC%EC%95%A1%ED%8A%B8-%EB%A6%AC%EB%89%B4%EC%96%BC/lecture/48859?tab=note
router.get('/:id',  async  (req,  res,  next)  =>  { 여기서 followers가 밑에 있으면 id중에서 follower란 이름의 아이디를 찾게되어 에러가 뜸

(6) 버튼 클릭시 리랜더링(리로드 or 새로고침) 방지
첫번째는, button에 type attribute에 button 으로 주는 방법입니다.  
두번째는, form에 onsubmit attribute에 return false 를 주는 방법입니다.  
  세번째 a태그로 대체(a태그에 스타일링입혀서 많이 한다고 함)  
  네번째 form태그를 div로 대체## **처음 서버시작**
 1. 작업관리자 > mysql 모두 끄기  2. 윈도우키 > 서비스 > mysql 시작하기

관련글 더보기

댓글 영역