-2

I want to display the featuredImage -> mediaItemUrl from this response I am able to map the authorId and title stuff but how to get the Media URL for image

const ALL_BLOGS = gql`
 {
  posts(last: 10) {
    nodes {
      authorId
      guid
      title
      commentCount
      commentStatus
      author {
        node {
          name
        }
      }
      date
      pinged
      uri
      featuredImage {
        node {
          mediaItemUrl
        }
      }
    }
  }
}

Here is the ReactJS code The code snippet

1 Answers1

0

In your snippet, it's look like you forget to put node before mediaItemUrl

{data.blog.featuredImage.map(featuredImage => (
             <li key={featuredImage.node>
                  <h2>{featuredImage.node.mediaItemUrl}</h2>
             </li>
))}
Babasile
  • 360
  • 1
  • 6
  • 13