• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

PostHead.tsx BackgroundImage 동작오류(자답)

22.10.30 17:11 작성 조회수 165

1

PostHead Head쪽에 오류가 발생하여 아래처럼 코드를 수정했습니다.

PostHead.tsx 파일의 아래코드를

type PostHeadProps = PostHeadInfoProps & {
  thumbnail: IGatsbyImageData
}

 

다음과 같이 변경해야 정상동작 했습니다.

type PostHeadProps = PostHeadInfoProps & {
  thumbnail: {
    childImageSharp: {
      gatsbyImageData: IGatsbyImageData
    }
  }
}

 

Index.tsx에서 PostList 썸네일 이미지를 가져오는 코드에서 thumbnail 가져오는 방식과 동일하게 PostHead.tsx에서 가져오니 저의 경우 정상동작 했습니다.
( 캐시 동작을 하는듯 하므로 npm run clean -> gatsby develop )

 

답변 0

답변을 작성해보세요.

답변을 기다리고 있는 질문이에요.
첫번째 답변을 남겨보세요!