Skip to content

Instantly share code, notes, and snippets.

@whisher
Created May 11, 2019 14:36
import React from "react"
import { graphql } from "gatsby"
import Img from "gatsby-image"
const Image = ({ data }) => (
<div>
<h1>Hello gatsby-image</h1>
{console.log(data)}
<Img fluid={data.file.childImageSharp.fluid} />
</div>
)
export default Image
export const query = graphql`
query {
file(relativePath: { eq: "fabio.jpg" }) {
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid
}
}
}
}
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment