Created
October 4, 2021 09:29
-
-
Save hackintoshrao/71dd0f1cdee66f240d3ae42ef683e85f to your computer and use it in GitHub Desktop.
This file contains hidden or 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, refetch } = useQuery(GET_DOG_PHOTO, { | |
variables: { breed } | |
}); | |
if (loading) return null; | |
if (error) return `Error! ${error}`; | |
return ( | |
<div> | |
<img src={data.dog.displayImage} style={{ height: 100, width: 100 }} /> | |
<button onClick={() => refetch()}>Refetch!</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment