import { gql, useQuery } from '@apollo/client'; import Link from 'next/link'; import { useRouter } from 'next/router'; import { Markets } from './__generated__/Markets'; const MARKETS_QUERY = gql` query Markets { markets { id } } `; const Markets = () => { const { pathname } = useRouter(); const { data, loading, error } = useQuery(MARKETS_QUERY); if (loading || !data) { return
Loading...
; } return (

Markets

{error ? (
Could not load markets {error.message}
) : ( )}
); }; export default Markets;