import React from 'react'; import { gql, useQuery } from 'urql'; const RANDOM_COLOR_QUERY = gql` query RandomColor { randomColor { name hex } } `; const RandomColorDisplay = () => { const [result] = useQuery({ query: RANDOM_COLOR_QUERY }); const { data, fetching, error } = result; return (
{fetching &&

Loading...

} {error &&

Oh no... {error.message}

} {data && (
{data.randomColor.name}
)} {result.operation && (

To get a result, the retry exchange retried:{' '} {result.operation.context.retryCount || 0} times.

)}
); }; export default RandomColorDisplay;