Created
August 24, 2019 09:20
-
-
Save arminyahya/b2eb3f5177ae3644a64e49d3d210132e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Layout from "../components/layout" | |
import SEO from "../components/seo" | |
import { useStaticQuery, graphql } from "gatsby" | |
import StarIcon from "../Icons/starIcon" | |
const IndexPage = () => { | |
const { movie } = useStaticQuery( | |
graphql` | |
query MyQuery { | |
movie { | |
movieList { | |
title | |
rate | |
year | |
} | |
} | |
} | |
` | |
) | |
return ( | |
<Layout> | |
<SEO title="Home" /> | |
<ul> | |
{movie.movieList.map(mov => ( | |
<li> | |
<div>{mov.title}({mov.year})</div> | |
<div className="rate-row"> | |
<StarIcon /> | |
<span className="rate-text">{mov.rate}</span> | |
</div> | |
</li> | |
))} | |
</ul> | |
</Layout> | |
) | |
} | |
export default IndexPage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment