강의

멘토링

커뮤니티

Inflearn Community Q&A

hanumoka's profile image
hanumoka

asked

Developing a Tech Blog with React-Based Gatsby

Implementing the top part of the post page

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

Written on

·

286

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 )

 

Gatsbyblog

Answer

This question is waiting for answers
Be the first to answer!
hanumoka's profile image
hanumoka

asked

Ask a question