Last active
August 3, 2019 13:57
-
-
Save arminyahya/b0658ef70c8ed20a7365cf62d9ffadc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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