import { useQuery } from "urql"; import { ArticleList } from "../components"; import { GetUnreadArticlesDocument } from "../graphql/generated/graphql"; const urqlContextArticle = { additionalTypenames: ["Article"] }; export function UnreadArticles() { const [{ data, fetching, error }] = useQuery({ query: GetUnreadArticlesDocument, context: urqlContextArticle, }); if (fetching) { return (

Loading unread articles...

); } if (error) { return (
Error: {error.message}
); } return (

Unread

{data?.unreadArticles && (

{data.unreadArticles.length} article {data.unreadArticles.length !== 1 ? "s" : ""} to read

)}
{data?.unreadArticles && ( )}
); }