Gatsby image path from json Gatsby image path from json json json

Gatsby image path from json


Your query should similar to this:

export const productsQuery = graphql`  query {    allDataJson {      edges {        node {          slug          name          image{            publicURL            childImageSharp{              fluid {                ...GatsbyImageSharpFluid              }            }          }        }      }    }  }`

Then you can output the path like this:

<img src={node.image.childImageSharp.fluid.src} />

You don't have to use fluid, you use other types of responsive images