1

I am trying to use graphQL in a GatsbyJS project, and am unsure how I can pull a specific 'URL' object, from a list of three, within a 'recipeImages' object. Right now, I can only pull the recipeImages object, like this:

<img src={node.recipeImages}/>

but I want to be able to get to the three individual URL objects seen in this query:

{
  "data": {
    "allContentfulBlogPost": {
      "edges": [
        {
          "node": {
            "id": "c1Qz3hWuPuQEIIUkSos0MEO",
            "postTitle": "Schwarzwälder Kirschtorte",
            "postDate": "2018-01-30T00:00+01:00",
            "slug": "schwarzwälder-kirschtorte",
            "methodText": {
              "childMarkdownRemark": {
                "html": "<p>This is the method text</p>"
              }
            },
            "recipeImages": [
              {
                "title": "imageOne",
                "file": {
                  "url": "//images.contentful.com/62o0h4ehxjxr/kkc57vWLPaEakYueyYqC6/c61b4641797a2fcaf3476ef9a3a24db6/image.jpg"
                }
              },
              {
                "title": "imageTwo",
                "file": {
                  "url": "//images.contentful.com/62o0h4ehxjxr/2ifxQEvnYwkaAe6e2YKISa/de2b6f62c4cac3b501fe76146b745790/image1.jpg"
                }
              },
              {
                "title": "imageThree",
                "file": {
                  "url": "//images.contentful.com/62o0h4ehxjxr/17g7ZHqrEWIgcyuye08myG/6b55386a31db2dd319148795953da7a4/image2.jpg"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

1 Answer 1

1

i got it:

<img src={recipeImages[0].responsiveResolution.src}/> 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.