mirror of
https://github.com/sergeyyarkov/next-apollo-graphql-setup.git
synced 2026-10-11 18:29:36 +03:00
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import Layout from '../components/Layout/Layout'
|
|
import SEO from '../components/SEO/SEO'
|
|
import Query from '../components/Query/query'
|
|
import ARTICLES_QUERY from '../apollo/queries/articles/articles';
|
|
import { withApollo } from '../lib/apollo';
|
|
|
|
|
|
const Articles = () => {
|
|
return (
|
|
<>
|
|
<SEO pageTitle='Articles page' />
|
|
<Layout>
|
|
<h1>Articles page</h1>
|
|
<div>
|
|
<Query query={ARTICLES_QUERY}>
|
|
{({ data: { articles } }) => {
|
|
return articles.map(art => {
|
|
return (
|
|
<div key={art.id}>
|
|
<p>
|
|
title: {art.title} <br />
|
|
id: {art.id}
|
|
</p>
|
|
</div>
|
|
)
|
|
})
|
|
}}
|
|
</Query>
|
|
</div>
|
|
</Layout>
|
|
</>
|
|
)
|
|
|
|
}
|
|
|
|
export default withApollo(Articles)
|