Skip to content

Instantly share code, notes, and snippets.

@arminyahya
Created August 24, 2019 09:20
Show Gist options
  • Save arminyahya/b2eb3f5177ae3644a64e49d3d210132e to your computer and use it in GitHub Desktop.
Save arminyahya/b2eb3f5177ae3644a64e49d3d210132e to your computer and use it in GitHub Desktop.
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