The prop children is marked as required in ... but its value is undefined

Seonhee Kim·2023년 9월 25일

에러노트

목록 보기
4/11

열심히 캐로셀 적용했더니 뜬 워닝
-> The prop children is marked as required in MaterialTailwind.Carousel, but its value is undefined.

자식이 필요한 태그 내부에 자식이 없어서 발생하는 에러로,
내용이 없을 경우 보여줄 예외 처리를 삼항연산자를 이용해 추가했더니 워닝이 사라짐


<article className="m-8 ">
   {postDetail?.image_urls.length !== 0 && (
      <Carousel className="rounded-xl w-full h-[450px] mb-6">
        {postDetail?.image_urls ? (
          postDetail?.image_urls?.map((item, index) => {
            return (
               <Image
                key={index}
                src={item}
                alt="image"
                width={300}
                height={300}
                className="w-full h-full object-cover"/>
                  )})) : (
                      <></>
                    )}
                  </Carousel>
                )}
             
</article>

profile
안녕하세요 ~_~

0개의 댓글