import { gql, useQuery } from "@apollo/client"; import { Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, } from "@material-ui/core"; import React, { FC } from "react"; import { Article } from '../generated/graphql'; const articles = gql` query Articles { articles { id title publishedAt } }`; export const ArticleIndex: FC = () => { const { data } = useQuery<{ articles: Article[]; }>(articles, {}); return (
Article Title Published At Views Comments {data?.articles.map((article) => ( {article.title} {article.publishedAt} -- -- ))}
); };