Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created October 4, 2021 09:24
Show Gist options
  • Save hackintoshrao/faf8e8d0f685fc5d7253e55d58550fde to your computer and use it in GitHub Desktop.
Save hackintoshrao/faf8e8d0f685fc5d7253e55d58550fde to your computer and use it in GitHub Desktop.
function DogPhoto({ breed }) {
const { loading, error, data } = useQuery(GET_DOG_PHOTO, {
variables: { breed },
pollInterval: 500,
});
if (loading) return null;
if (error) return `Error! ${error}`;
return (
<img src={data.dog.displayImage} style={{ height: 100, width: 100 }} />
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment