inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

onCreate 이후 property 의 undefind 에러

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

add 후에 List페이지로 이동하면, 흰화면으로 에러가 출력됩니다. Home.js 의 프로퍼티에 대해 undefind 가 출력됩니다. [Uncaught TypeError: Cannot read properties of undefined (reading 'length') at Home.js:15:1] [ diaryList.length >= 1 ] : 에러 발생하는 부분 useEffect (() => { if ( diaryList . length >= 1 ) { //에러발생부분 const firstDay = new Date ( curDate . getFullYear (), curDate . getMonth (), 1 ). getTime (); const lastDay = new Date ( curDate . getFullYear (), curDate . getMonth () + 1 , 0 ). getTime (); setData ( diaryList . filter (( it ) => firstDay <= it . date && it . date <= lastDay ) ); } }, [ diaryList , curDate ]);

  • Home.js
  • javascript
  • property
  • nodejs
  • undefind
  • react
  • length
gwi01304 댓글 2 좋아요 0 조회수 419

인기 태그

인프런 TOP Writers

주간 인기글