Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created October 4, 2021 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackintoshrao/71dd0f1cdee66f240d3ae42ef683e85f to your computer and use it in GitHub Desktop.
Save hackintoshrao/71dd0f1cdee66f240d3ae42ef683e85f to your computer and use it in GitHub Desktop.
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