Created
October 4, 2021 09:24
-
-
Save hackintoshrao/faf8e8d0f685fc5d7253e55d58550fde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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