Skip to content

Instantly share code, notes, and snippets.

@arminyahya
Last active August 3, 2019 13:57
Show Gist options
  • Save arminyahya/b0658ef70c8ed20a7365cf62d9ffadc8 to your computer and use it in GitHub Desktop.
Save arminyahya/b0658ef70c8ed20a7365cf62d9ffadc8 to your computer and use it in GitHub Desktop.
import React from "react"
import { Link } from "gatsby"
import Layout from "../components/layout"
import Image from "../components/image"
import SEO from "../components/seo"
import { useStaticQuery, graphql } from "gatsby"
const IndexPage = () => {
const MovieResult = useStaticQuery(
graphql`
query MyQuery {
Movie {
movies {
title
rate
}
}
}
`
)
const movies = MovieResult.Movie.movies;
return(
<Layout>
<SEO title="Home" />
<ul>
{movies.map((movie) => (
<li>
<p>{movie.title}({movie.rate})</p>
</li>
))}
</ul>
</Layout>
)}
export default IndexPage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment