import { useQuery } from "urql"; import { ArticleList } from "../components"; import { GetUnreadArticlesDocument } from "../graphql/generated/graphql"; export function UnreadArticles() { const [{ data, fetching, error }] = useQuery({ query: GetUnreadArticlesDocument, }); if (fetching) { return
Loading unread articles...
; } if (error) { return
Error: {error.message}
; } return (

Unread Articles

{data?.unreadArticles && (

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

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